Created
October 30, 2020 03:20
-
-
Save chamithchathuka/60cb1e8b168e087d6694e97b3667b1ec to your computer and use it in GitHub Desktop.
Flutter Firebase Remote Config - Initial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
void main() { | |
runApp(GetMaterialApp( | |
initialRoute: '/page1', | |
title: '', | |
theme: ThemeData.light().copyWith(primaryColor: Colors.green), | |
darkTheme: ThemeData.dark().copyWith(primaryColor: Colors.purple,backgroundColor: Colors.black, ), | |
themeMode: ThemeMode.light, | |
getPages: [ | |
//Simple GetPage | |
GetPage(name: '/page1', page: () => Page1()), | |
GetPage(name: '/page2', page: () => Page2()), | |
// GetPage with custom transitions and bindings | |
], | |
)); | |
} | |
class Page2 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
// TODO: implement build | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Page 2'), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
'You have pushed the button this many times:', | |
), | |
RaisedButton( | |
child: Text('Go to Page 1'), | |
onPressed: () { | |
Get.changeThemeMode(ThemeMode.light); //STEP 3 - change themes | |
Get.toNamed('/page1'); | |
}, | |
) | |
], | |
), | |
), | |
// This trailing comma makes auto-formatting nicer for build methods. | |
); | |
} | |
} | |
class Page1 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
// TODO: implement build | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Page 1'), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
'You have pushed the button this many times:', | |
), | |
RaisedButton( | |
child: Text('Go to Page 2'), | |
onPressed: () { | |
Get.changeThemeMode(ThemeMode.dark); //STEP 3 - change themes | |
Get.toNamed('/page2'); | |
}, | |
) | |
], | |
), | |
), | |
// This trailing comma makes auto-formatting nicer for build methods. | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment