@@ -9,6 +9,9 @@ class WebViewExample extends StatefulWidget {
99}
1010
1111class WebViewExampleState extends State <WebViewExample > {
12+ bool visible = true ;
13+ final url = 'https://github.com/alibaba/flutter_boost' ;
14+
1215 @override
1316 void initState () {
1417 super .initState ();
@@ -38,21 +41,87 @@ class WebViewExampleState extends State<WebViewExample> {
3841 margin: const EdgeInsets .all (10.0 ),
3942 color: Colors .yellow,
4043 child: Text (
41- 'open flutter page' ,
42- style: TextStyle (fontSize: 22 .0 , color: Colors .black),
44+ 'Open flutter page' ,
45+ style: TextStyle (fontSize: 20 .0 , color: Colors .black),
4346 )),
4447 onTap: () => BoostNavigator .instance
4548 .push ("flutterPage" , withContainer: true ),
4649 ),
50+ InkWell (
51+ child: Container (
52+ margin: const EdgeInsets .all (10.0 ),
53+ color: Colors .yellow,
54+ child: Text (
55+ 'Open another webview' ,
56+ style: TextStyle (fontSize: 20.0 , color: Colors .black),
57+ )),
58+ onTap: () => BoostNavigator .instance
59+ .push ("webview" , withContainer: true ),
60+ ),
4761 Expanded (
48- child: Container (
49- margin: const EdgeInsets .all (10.0 ),
50- decoration:
51- BoxDecoration (border: Border .all (color: Colors .blueAccent)),
52- child: WebView (
53- initialUrl: 'https://github.com/alibaba/flutter_boost' ,
62+ child: Column (
63+ children: < Widget > [
64+ Container (
65+ width: 1080 ,
66+ height: 50 ,
67+ margin: const EdgeInsets .all (10.0 ),
68+ child: MaterialButton (
69+ color: Colors .blue,
70+ child: Text (
71+ 'Click me to change something ~~' ,
72+ style: TextStyle (fontSize: 20.0 , color: Colors .white),
73+ ),
74+ onPressed: () {
75+ setState (() {
76+ visible = ! visible;
77+ });
78+ },
79+ ),
80+ ),
81+ Stack (
82+ children: < Widget > [
83+ if (visible)
84+ Container (
85+ decoration: BoxDecoration (
86+ border:
87+ Border .all (color: Colors .blue, width: 5.0 )),
88+ width: 400 ,
89+ height: 300 ,
90+ margin: const EdgeInsets .all (10.0 ),
91+ child: WebView (
92+ initialUrl: url,
93+ ),
94+ ),
95+ Opacity (
96+ opacity: visible ? 1.0 : 0.5 ,
97+ child: Container (
98+ decoration: BoxDecoration (
99+ border:
100+ Border .all (color: Colors .red, width: 5.0 )),
101+ width: 200 ,
102+ height: 200 ,
103+ margin: const EdgeInsets .all (10.0 ),
104+ child: WebView (
105+ initialUrl: url,
106+ ),
107+ ),
108+ ),
109+ Container (
110+ decoration: BoxDecoration (
111+ border:
112+ Border .all (color: Colors .blue, width: 5.0 )),
113+ width: 100 ,
114+ height: 100 ,
115+ margin: const EdgeInsets .all (10.0 ),
116+ child: WebView (
117+ initialUrl: url,
118+ ),
119+ ),
120+ ],
121+ ),
122+ ],
54123 ),
55- )) ,
124+ ),
56125 ]))));
57126 }
58127}
0 commit comments