【发布时间】:2021-08-05 02:29:01
【问题描述】:
要在我的容器中制作圆角,我可以这样做
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20))
),
child: ...
)
但是每当我创建一个圆角的容器时,我都需要一遍又一遍地做。我可以在我的主题数据中设置它吗?我可以像下面的代码一样在主题数据中设置我的 appBar 主题,但我需要类似的东西,但对于容器。该怎么做?
final themeData = ThemeData(
appBarTheme: _appBarTheme,
);
const AppBarTheme _appBarTheme = const AppBarTheme(
elevation: 2,
centerTitle: true,
color: const Color.fromRGBO(245, 245, 245, 1),
textTheme: TextTheme(
// center text style
headline6: TextStyle(color: Colors.black, fontSize: 16),
// Side text style
bodyText2: TextStyle(color: Colors.black),
),
);
【问题讨论】:
标签: flutter dart containers flutter-widget