Skip to content

Commit

Permalink
Update example text color
Browse files Browse the repository at this point in the history
Signed-off-by: CaiJingLong <cjl_spy@163.com>
  • Loading branch information
CaiJingLong committed Nov 17, 2023
1 parent 43e23a0 commit 922a953
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return buildApp();
}

// 2-A: Wrap MaterialApp with OKToast.
Widget buildWrapperApp() {
return OKToast(
// 2-A: wrap your app with OKToast
textStyle: const TextStyle(fontSize: 19.0, color: Colors.white),
backgroundColor: Colors.grey,
animationCurve: Curves.easeIn,
animationBuilder: const Miui10AnimBuilder().call,
animationDuration: const Duration(milliseconds: 200),
duration: const Duration(seconds: 3),
child: MaterialApp(
title: 'Demo for OKToast',
theme: ThemeData(
Expand All @@ -34,7 +33,15 @@ class MyApp extends StatelessWidget {
Widget buildApp() {
return MaterialApp(
home: const MyHomePage(),
builder: (_, Widget? child) => OKToast(child: child!),
builder: (_, Widget? child) => OKToast(
textStyle: const TextStyle(fontSize: 19.0, color: Colors.white),
backgroundColor: Colors.grey,
animationCurve: Curves.easeIn,
animationBuilder: const Miui10AnimBuilder().call,
animationDuration: const Duration(milliseconds: 200),
duration: const Duration(seconds: 3),
child: child!,
),
);
}
}
Expand All @@ -61,7 +68,7 @@ class _MyHomePageState extends State<MyHomePage> {
position: ToastPosition.bottom,
backgroundColor: Colors.black.withOpacity(0.8),
radius: 13.0,
textStyle: const TextStyle(fontSize: 18.0),
textStyle: const TextStyle(fontSize: 18.0, color: Colors.white),
animationBuilder: const Miui10AnimBuilder().call,
);

Expand All @@ -71,7 +78,7 @@ class _MyHomePageState extends State<MyHomePage> {
position: ToastPosition.top,
backgroundColor: Colors.black.withOpacity(0.8),
radius: 3.0,
textStyle: const TextStyle(fontSize: 30.0),
textStyle: const TextStyle(fontSize: 30.0, color: Colors.white),
);

// 3-B use showToastWidget method
Expand Down

0 comments on commit 922a953

Please sign in to comment.