|
@@ -1,6 +1,7 @@
|
1
|
1
|
import 'dart:async';
|
2
|
2
|
|
3
|
3
|
import 'package:farmer_client/models/Store.dart';
|
|
4
|
+import 'package:farmer_client/pages/home.dart';
|
4
|
5
|
import 'package:farmer_client/pages/login/login.dart';
|
5
|
6
|
import 'package:flutter/material.dart';
|
6
|
7
|
import 'package:get/get.dart';
|
|
@@ -11,9 +12,10 @@ import 'widgets/OrderListCard.dart';
|
11
|
12
|
|
12
|
13
|
|
13
|
14
|
void main() async {
|
14
|
|
- Store().init();
|
15
|
15
|
await GetStorage.init();
|
16
|
|
- runApp(const MyApp());
|
|
16
|
+ Store().init();
|
|
17
|
+
|
|
18
|
+ runApp(MyApp());
|
17
|
19
|
}
|
18
|
20
|
|
19
|
21
|
class MyApp extends StatelessWidget {
|
|
@@ -22,24 +24,40 @@ class MyApp extends StatelessWidget {
|
22
|
24
|
// This widget is the root of your application.
|
23
|
25
|
@override
|
24
|
26
|
Widget build(BuildContext context) {
|
25
|
|
-
|
26
|
|
- return MaterialApp(
|
27
|
|
- title: 'Flutter Demo',
|
28
|
|
- theme: ThemeData(
|
29
|
|
- // This is the theme of your application.
|
30
|
|
- //
|
31
|
|
- // Try running your application with "flutter run". You'll see the
|
32
|
|
- // application has a blue toolbar. Then, without quitting the app, try
|
33
|
|
- // changing the primarySwatch below to Colors.green and then invoke
|
34
|
|
- // "hot reload" (press "r" in the console where you ran "flutter run",
|
35
|
|
- // or simply save your changes to "hot reload" in a Flutter IDE).
|
36
|
|
- // Notice that the counter didn't reset back to zero; the application
|
37
|
|
- // is not restarted.
|
38
|
|
- primarySwatch: Colors.blue,
|
39
|
|
- ),
|
40
|
|
- home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
41
|
|
-
|
|
27
|
+ GetStorage box = GetStorage();
|
|
28
|
+
|
|
29
|
+ return ScreenUtilInit(
|
|
30
|
+ designSize: const Size(375, 812),
|
|
31
|
+ minTextAdapt: true,
|
|
32
|
+ splitScreenMode: true,
|
|
33
|
+ builder: (_) {
|
|
34
|
+ return GetMaterialApp(
|
|
35
|
+ initialRoute: '/home',
|
|
36
|
+ defaultTransition: Transition.native,
|
|
37
|
+ getPages: [
|
|
38
|
+ GetPage(name: '/home', page: () => box.hasData('token') ? Home() : MyRouteLogin()),
|
|
39
|
+ ],
|
|
40
|
+ );
|
|
41
|
+ },
|
42
|
42
|
);
|
|
43
|
+
|
|
44
|
+ // return MaterialApp(
|
|
45
|
+ // title: 'Flutter Demo',
|
|
46
|
+ // theme: ThemeData(
|
|
47
|
+ // // This is the theme of your application.
|
|
48
|
+ // //
|
|
49
|
+ // // Try running your application with "flutter run". You'll see the
|
|
50
|
+ // // application has a blue toolbar. Then, without quitting the app, try
|
|
51
|
+ // // changing the primarySwatch below to Colors.green and then invoke
|
|
52
|
+ // // "hot reload" (press "r" in the console where you ran "flutter run",
|
|
53
|
+ // // or simply save your changes to "hot reload" in a Flutter IDE).
|
|
54
|
+ // // Notice that the counter didn't reset back to zero; the application
|
|
55
|
+ // // is not restarted.
|
|
56
|
+ // primarySwatch: Colors.blue,
|
|
57
|
+ // ),
|
|
58
|
+ // home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
59
|
+ //
|
|
60
|
+ // );
|
43
|
61
|
}
|
44
|
62
|
}
|
45
|
63
|
|