本地申请:
showDialog(
context: context,
builder: (context) {
return Dialog(
backgroundColor: Colors.grey,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
side: BorderSide(width: 3.0, color: Colors.black),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
"title",
style: getBodyTextStyle(),
),
),
);
},
);
全球应用:
class Application extends StatelessWidget {
@override
Widget build(BuildContext context) {
final baseThemeData = ThemeData.light();
final themeData = baseThemeData.copyWith(
dialogTheme: baseThemeData.dialogTheme.copyWith(
backgroundColor: Colors.grey,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
side: BorderSide(width: 3.0, color: Colors.black),
),
),
);
return MaterialApp(
themeMode: ThemeMode.light,
theme: themeData,
...
);
}
void _openDialog(BuildContext context) {
showDialog(
context: context,
builder: (context) {
return Dialog(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
"title",
style: getBodyTextStyle(),
),
),
);
},
);
}
}
两种变体的结果: