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