Skip to content

Instantly share code, notes, and snippets.

@nkenna
Last active July 31, 2021 19:17
Show Gist options
  • Save nkenna/0e426bd7b5b685b62d798772f6487b4c to your computer and use it in GitHub Desktop.
Save nkenna/0e426bd7b5b685b62d798772f6487b4c to your computer and use it in GitHub Desktop.
content of my main.dart file
// themeData for IOS
final ThemeData kIOSTheme = new ThemeData(
primarySwatch: materialMainColor,
primaryColor: mainColor,
primaryIconTheme: IconThemeData(color: Colors.white),
primaryColorBrightness: Brightness.light,
visualDensity: VisualDensity.adaptivePlatformDensity,
fontFamily: 'JakartaRegular'
);
// themeData for Android
final ThemeData kDefaultTheme = new ThemeData(
primarySwatch: materialMainColor,
primaryColor: mainColor,
accentColor: mainColor,
primaryIconTheme: IconThemeData(color: Colors.white),
primaryColorBrightness: Brightness.dark,
visualDensity: VisualDensity.adaptivePlatformDensity,
fontFamily: 'JakartaRegular'
);
void main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: mainColor, // affects the status bar color.
statusBarIconBrightness: Brightness.light,
systemNavigationBarIconBrightness: Brightness.light,
statusBarBrightness: Brightness.light,
systemNavigationBarColor: mainColor,
)
);
runApp(
MultiProvider(providers: [
ChangeNotifierProvider(create: (context) => LandingProvider()),
ChangeNotifierProvider(create: (context) => AuthProvider()),
ChangeNotifierProvider(create: (context) => AddressProvider()),
],
child: MyApp(),
)
);
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return DismissKeyboard(
child: GetMaterialApp(
title: 'VicPharm Customer',
debugShowCheckedModeBanner: false,
theme: Platform.isIOS ? kIOSTheme : kDefaultTheme, // check which platform theme to use
home: SplashScreen()
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment