123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <<<<<<< HEAD
  2. import 'package:farmer_client/models/Store.dart';
  3. import 'package:farmer_client/pages/home.dart';
  4. import 'package:farmer_client/pages/login/login.dart';
  5. import 'package:farmer_client/widgets/CarsCard.dart';
  6. import 'package:farmer_client/widgets/OrderInfoCard.dart';
  7. =======
  8. >>>>>>> aab895cc95471d4dfd7cb90d05a35ccceb52c4e0
  9. import 'package:flutter/material.dart';
  10. import 'package:get/get.dart';
  11. import 'package:get_storage/get_storage.dart';
  12. import 'package:flutter_screenutil/flutter_screenutil.dart';
  13. import 'models/index.dart';
  14. import 'routes/index.dart';
  15. import 'widgets/OrderListCard.dart';
  16. void main() async {
  17. await GetStorage.init();
  18. runApp(MyApp());
  19. }
  20. class MyApp extends StatelessWidget {
  21. const MyApp({Key? key}) : super(key: key);
  22. // This widget is the root of your application.
  23. @override
  24. Widget build(BuildContext context) {
  25. GetStorage box = GetStorage();
  26. return ScreenUtilInit(
  27. designSize: const Size(375, 812),
  28. minTextAdapt: true,
  29. splitScreenMode: true,
  30. builder: (_) {
  31. return GetMaterialApp(
  32. initialRoute: '/splash',
  33. defaultTransition: Transition.native,
  34. <<<<<<< HEAD
  35. getPages: [
  36. // GetPage(name: '/home', page: () => OrderPage() ),
  37. GetPage(name: '/home', page: () => box.hasData('token') ? Home() : MyRouteLogin()),
  38. ],
  39. =======
  40. routingCallback: routingCallback,
  41. initialBinding: AppBindings(),
  42. getPages: pages,
  43. >>>>>>> aab895cc95471d4dfd7cb90d05a35ccceb52c4e0
  44. );
  45. },
  46. );
  47. // return MaterialApp(
  48. // title: 'Flutter Demo',
  49. // theme: ThemeData(
  50. // // This is the theme of your application.
  51. // //
  52. // // Try running your application with "flutter run". You'll see the
  53. // // application has a blue toolbar. Then, without quitting the app, try
  54. // // changing the primarySwatch below to Colors.green and then invoke
  55. // // "hot reload" (press "r" in the console where you ran "flutter run",
  56. // // or simply save your changes to "hot reload" in a Flutter IDE).
  57. // // Notice that the counter didn't reset back to zero; the application
  58. // // is not restarted.
  59. // primarySwatch: Colors.blue,
  60. // ),
  61. // home: const MyHomePage(title: 'Flutter Demo Home Page'),
  62. //
  63. // );
  64. }
  65. }
  66. class MyHomePage extends StatefulWidget {
  67. const MyHomePage({Key? key,}) : super(key: key);
  68. // This widget is the home page of your application. It is stateful, meaning
  69. // that it has a State object (defined below) that contains fields that affect
  70. // how it looks.
  71. // This class is the configuration for the state. It holds the values (in this
  72. // case the title) provided by the parent (in this case the App widget) and
  73. // used by the build method of the State. Fields in a Widget subclass are
  74. // always marked "final".
  75. // final String title;
  76. @override
  77. State<MyHomePage> createState() => _MyHomePageState();
  78. }
  79. class _MyHomePageState extends State<MyHomePage> {
  80. int _counter = 0;
  81. @override
  82. Widget build(BuildContext context) {
  83. // var find = Get.find(tag: 'user');
  84. // This method is rerun every time setState is called, for instance as done
  85. // by the _incrementCounter method above.
  86. //
  87. // The Flutter framework has been optimized to make rerunning build methods
  88. // fast, so that you can just rebuild anything that needs updating rather
  89. // than having to individually change instances of widgets.
  90. return Scaffold(
  91. appBar: AppBar(
  92. backgroundColor: Colors.amber,
  93. // Here we take the value from the MyHomePage object that was created by
  94. // the App.build method, and use it to set our appbar title.
  95. title: Text('widget.title'),
  96. ),
  97. body: Center(
  98. // Center is a layout widget. It takes a single child and positions it
  99. // in the middle of the parent.
  100. child: Column(
  101. // Column is also a layout widget. It takes a list of children and
  102. // arranges them vertically. By default, it sizes itself to fit its
  103. // children horizontally, and tries to be as tall as its parent.
  104. //
  105. // Invoke "debug painting" (press "p" in the console, choose the
  106. // "Toggle Debug Paint" action from the Flutter Inspector in Android
  107. // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
  108. // to see the wireframe for each widget.
  109. //
  110. // Column has various properties to control how it sizes itself and
  111. // how it positions its children. Here we use mainAxisAlignment to
  112. // center the children vertically; the main axis here is the vertical
  113. // axis because Columns are vertical (the cross axis would be
  114. // horizontal).
  115. mainAxisAlignment: MainAxisAlignment.center,
  116. children: <Widget>[
  117. // Text(
  118. // '$_counter',
  119. // style: Theme.of(context).textTheme.headline4,
  120. // ),
  121. // DefaultButton(
  122. // margin: EdgeInsets.fromLTRB(0, 30.0, 0, 0), //可选配置,自定义控件中有默认配置
  123. // text: "登陆",
  124. // width: 120.0,
  125. // height: 50.0,
  126. // fontSize: 20.0,
  127. // backColor: Color(0xffff703b),
  128. // color: Colors.white,
  129. // onPressed: () {
  130. // Navigator.push(
  131. // context,
  132. // MaterialPageRoute(builder: (context) {
  133. // return MyRouteLogin();
  134. // }),
  135. // );
  136. // },
  137. // ),
  138. CarsCard(),
  139. // Search()
  140. // OrderListCard()
  141. ],
  142. ),
  143. ),
  144. // This trailing comma makes auto-formatting nicer for build methods.
  145. );
  146. }
  147. }