@@ -10,56 +10,64 @@ var dbHelper = DatabaseHelper();
10
10
class MainPage extends StatelessWidget {
11
11
@override
12
12
Widget build (BuildContext context) {
13
- //doWeHaveNet();
14
- if (doWeHaveNet () != true ) {
15
- debugPrint (" FALSE ALL " );
16
- return Container (
17
- child: RaisedButton (
18
- onPressed: () {
19
- // doWeHaveNet();
20
- //debugPrint(" true one ");
13
+ return Scaffold (
14
+ appBar: AppBar (title: Icon (Icons .access_alarm),),
15
+ // body: Container(child: offlineCheck()) ,
21
16
22
- if (doWeHaveNet () == true ) {
23
- debugPrint (" true ONE " );
24
- Navigator .of (context).pushNamed ('/HawalnirHome2' );
25
- }else {
17
+ );
26
18
27
- debugPrint ("try again " );
28
- if (doWeHaveNet () != false ){
29
- print (doWeHaveNet ().toString ());
30
- Navigator .of (context).pushNamed ('/HawalnirHome2' );
31
- }
32
19
33
- }
34
- },
35
- child: Text ("dsdsd" ),
36
- ));
37
- }else {
38
- debugPrint (" false 1" );
39
- return HawalnirHome2 ();
40
- } }
41
- }
42
-
43
- doWeHaveNet () async {
44
- //TODO POP something to know connection is lost
45
- int count = await dbHelper.getCount ();
46
- try {
47
- final result = await InternetAddress .lookup ('google.com' );
48
- if (result.isNotEmpty && result[0 ].rawAddress.isNotEmpty) {
49
- print ('connected' );
50
- netConnection = true ;
51
- // return weHaveNet(HawalnirHome2State().context);
52
- return true ;
53
- }
54
-
55
- } on SocketException catch (_) {
56
- print ('not connected' );
57
- if (count < 1 ) {
58
- debugPrint ('we need intenet' );
59
- // netConnection = false;
60
- // return false;
61
- }
62
20
}
63
-
64
- //TODO put a nice widget here for Connectivity problems
65
21
}
22
+ //doWeHaveNet();
23
+ // if (doWeHaveNet() != true) {
24
+ // debugPrint(" FALSE ALL ");
25
+ // return Container(
26
+ // child: RaisedButton(
27
+ // onPressed: () {
28
+ // // doWeHaveNet();
29
+ // //debugPrint(" true one ");
30
+ //
31
+ // if (doWeHaveNet() == true) {
32
+ // debugPrint(" true ONE ");
33
+ // Navigator.of(context).pushNamed('/HawalnirHome2');
34
+ // }else {
35
+ //
36
+ // debugPrint("try again ");
37
+ // if(doWeHaveNet() != false){
38
+ // print(doWeHaveNet().toString());
39
+ // Navigator.of(context).pushNamed('/HawalnirHome2');
40
+ // }
41
+ //
42
+ // }
43
+ // },
44
+ // child: Text("dsdsd"),
45
+ // ));
46
+ // }else {
47
+ // debugPrint(" false 1");
48
+ // return HawalnirHome2();
49
+ // } }
50
+ //}
51
+ //
52
+ //doWeHaveNet() async {
53
+ // //TODO POP something to know connection is lost
54
+ // int count = await dbHelper.getCount();
55
+ // try {
56
+ // final result = await InternetAddress.lookup('google.com');
57
+ // if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
58
+ // print('connected');
59
+ // netConnection = true;
60
+ //// return weHaveNet(HawalnirHome2State().context);
61
+ // return true;
62
+ // }
63
+ //
64
+ // } on SocketException catch (_) {
65
+ // print('not connected');
66
+ // if (count < 1) {
67
+ // debugPrint('we need intenet');
68
+ //// netConnection = false;
69
+ //// return false;
70
+ // }
71
+ // }
72
+ //
73
+ // //TODO put a nice widget here for Connectivity problems
0 commit comments