main.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import 'package:cool_ui_example/cool_u_i_example_icons.dart';
  2. import 'package:cool_ui_example/pages/custom_keyboard.dart';
  3. import 'package:cool_ui_example/pages/paint_event_demo.dart';
  4. import 'package:cool_ui_example/pages/popover_demo.dart';
  5. import 'package:cool_ui_example/pages/weui_toast_demo.dart';
  6. import 'package:cool_ui/cool_ui.dart';
  7. import 'package:flutter/material.dart';
  8. void main(){
  9. NumberKeyboard.register();
  10. runApp(MyApp());
  11. }
  12. class MyApp extends StatelessWidget {
  13. // This widget is the root of your application.
  14. @override
  15. Widget build(BuildContext context) {
  16. return MaterialApp(
  17. title: 'Flutter Demo',
  18. theme: ThemeData(
  19. // This is the theme of your application.
  20. //
  21. // Try running your application with "flutter run". You'll see the
  22. // application has a blue toolbar. Then, without quitting the app, try
  23. // changing the primarySwatch below to Colors.green and then invoke
  24. // "hot reload" (press "r" in the console where you ran "flutter run",
  25. // or press Run > Flutter Hot Reload in IntelliJ). Notice that the
  26. // counter didn't reset back to zero; the application is not restarted.
  27. primarySwatch: Colors.blue
  28. ),
  29. home: MyHomePage(title: 'Flutter Demo Home Page')
  30. );
  31. }
  32. }
  33. class MyHomePage extends StatefulWidget {
  34. MyHomePage({Key key, this.title}) : super(key: key);
  35. // This widget is the home page of your application. It is stateful, meaning
  36. // that it has a State object (defined below) that contains fields that affect
  37. // how it looks.
  38. // This class is the configuration for the state. It holds the values (in this
  39. // case the title) provided by the parent (in this case the App widget) and
  40. // used by the build method of the State. Fields in a Widget subclass are
  41. // always marked "final".
  42. final String title;
  43. @override
  44. _MyHomePageState createState() => _MyHomePageState();
  45. }
  46. class _MyHomePageState extends State<MyHomePage> {
  47. int _counter = 0;
  48. void _incrementCounter() {
  49. setState(() {
  50. // This call to setState tells the Flutter framework that something has
  51. // changed in this State, which causes it to rerun the build method below
  52. // so that the display can reflect the updated values. If we changed
  53. // _counter without calling setState(), then the build method would not be
  54. // called again, and so nothing would appear to happen.
  55. _counter++;
  56. });
  57. }
  58. @override
  59. Widget build(BuildContext context) {
  60. // This method is rerun every time setState is called, for instance as done
  61. // by the _incrementCounter method above.
  62. //
  63. // The Flutter framework has been optimized to make rerunning build methods
  64. // fast, so that you can just rebuild anything that needs updating rather
  65. // than having to individually change instances of widgets.
  66. return Scaffold(
  67. appBar: AppBar(
  68. // Here we take the value from the MyHomePage object that was created by
  69. // the App.build method, and use it to set our appbar title.
  70. title: Text(widget.title),
  71. ),
  72. body: ListView(
  73. children: <Widget>[
  74. ListTile(
  75. leading: Icon(CoolUIExampleIcon.popover),
  76. title: Text("Popover"),
  77. onTap: (){
  78. Navigator.of(context).push(MaterialPageRoute(builder: (context)=>PopoverDemo()));
  79. },
  80. ),
  81. ListTile(
  82. title: Text("PaintEvent"),
  83. onTap: (){
  84. Navigator.of(context).push(MaterialPageRoute(builder: (context)=>PaintEventDemo()));
  85. },
  86. ),
  87. ListTile(
  88. title: Text("WeuiToastEvent"),
  89. onTap: (){
  90. Navigator.of(context).push(MaterialPageRoute(builder: (context)=>WeuiToastDemo()));
  91. },
  92. ),
  93. ListTile(
  94. title: Text("CustomKeyboardEvent"),
  95. onTap: (){
  96. Navigator.of(context).push(MaterialPageRoute(builder: (context)=>CustomKeyboardDemo()));
  97. },
  98. )
  99. ],
  100. )
  101. );
  102. }
  103. }