-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathsimple_widget.dart
168 lines (159 loc) · 5.94 KB
/
simple_widget.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_boost/flutter_boost.dart';
class SimpleWidget extends StatefulWidget {
final Map? params;
final String messages;
final String? uniqueId;
const SimpleWidget(this.uniqueId, this.params, this.messages);
@override
State<SimpleWidget> createState() => _SimpleWidgetState();
}
class _SimpleWidgetState extends State<SimpleWidget>
with PageVisibilityObserver {
static const String _kTag = 'page_visibility';
@override
void didChangeDependencies() {
PageVisibilityBinding.instance.addObserver(this, ModalRoute.of(context)!);
debugPrint('$_kTag#didChangeDependencies, ${widget.uniqueId}, $this');
super.didChangeDependencies();
}
@override
void initState() {
debugPrint('$_kTag#initState, ${widget.uniqueId}, $this');
super.initState();
}
@override
void dispose() {
PageVisibilityBinding.instance.removeObserver(this);
debugPrint('$_kTag#dispose, ${widget.uniqueId}, $this');
super.dispose();
}
@override
void onPageShow() {
debugPrint('$_kTag#onPageShow, ${widget.uniqueId}, $this');
}
@override
void onPageHide() {
debugPrint('$_kTag#onPageHide, ${widget.uniqueId}, $this');
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('tab_example'),
),
body: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: const EdgeInsets.only(top: 80.0),
alignment: AlignmentDirectional.center,
child: Text(
widget.messages,
style: const TextStyle(fontSize: 28.0, color: Colors.blue),
),
),
Container(
padding: const EdgeInsets.all(8.0),
margin: const EdgeInsets.only(top: 32.0),
alignment: AlignmentDirectional.center,
child: Text(
widget.uniqueId!,
style: const TextStyle(fontSize: 16.0, color: Colors.red),
),
),
const CupertinoTextField(
prefix: Icon(
CupertinoIcons.person_solid,
color: CupertinoColors.lightBackgroundGray,
size: 28.0,
),
padding: EdgeInsets.symmetric(horizontal: 6.0, vertical: 12.0),
clearButtonMode: OverlayVisibilityMode.editing,
textCapitalization: TextCapitalization.words,
),
InkWell(
child: Container(
padding: const EdgeInsets.all(8.0),
margin: const EdgeInsets.all(30.0),
color: Colors.yellow,
child: const Text(
'open native page',
style: TextStyle(fontSize: 22.0, color: Colors.black),
)),
onTap: () => BoostNavigator.instance.push("native").then(
(value) {
if (mounted) {
ScaffoldMessenger.of(context)
..removeCurrentSnackBar()
..showSnackBar(SnackBar(content: Text("$value")));
}
}),
),
InkWell(
child: Container(
padding: const EdgeInsets.all(8.0),
margin: const EdgeInsets.all(30.0),
color: Colors.yellow,
child: const Text(
'open flutter page',
style: TextStyle(fontSize: 22.0, color: Colors.black),
)),
onTap: () => BoostNavigator.instance.push("flutterPage",
arguments: <String, String?>{'from': widget.uniqueId}),
),
InkWell(
child: Container(
padding: const EdgeInsets.all(8.0),
margin: const EdgeInsets.all(30.0),
color: Colors.yellow,
child: const Text(
'open flutter page with FlutterView',
style: TextStyle(fontSize: 22.0, color: Colors.black),
)),
onTap: () => BoostNavigator.instance.push("flutterPage",
withContainer: true,
arguments: <String, String?>{'from': widget.uniqueId}),
),
InkWell(
child: Container(
padding: const EdgeInsets.all(8.0),
margin: const EdgeInsets.all(30.0),
color: Colors.yellow,
child: const Text(
'Navigator.push',
style: TextStyle(fontSize: 22.0, color: Colors.black),
)),
onTap: () => Navigator.push(context, MaterialPageRoute<void>(
builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Navigator.push')),
body: Center(
child: TextButton(
child: const Text('POP'),
onPressed: () {
Navigator.pop(context);
},
),
),
);
},
)),
),
const SizedBox(
height: 300,
width: 200,
child: Text(
'',
style: TextStyle(fontSize: 22.0, color: Colors.black),
),
)
],
))),
);
}
}