From ff452ad93d50af6412dae3198559f87dd6a1ca20 Mon Sep 17 00:00:00 2001 From: zhujian1989 <370159662@qq.com> Date: Mon, 16 Jul 2018 17:18:08 +0800 Subject: [PATCH] commit --- .idea/workspace.xml | 303 +++++++++++++++----------------------- lib/widget/home_page.dart | 30 +++- 2 files changed, 146 insertions(+), 187 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0945700..a3c8599 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,25 +7,7 @@ - - - - - - - - - - - - - - - - - - - + @@ -51,28 +33,8 @@ - - - - - - - - - - - - - - - - - - - - - - + + @@ -80,71 +42,53 @@ - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -162,17 +106,6 @@ - onDragStarted - appBarHeight - statusBarHeight - drag_item_height - size - DraggableCanceledCallback - targetingInfo - _refreshIndicatorKey - UIApplicationDelegate - color - rotate radius StaggeredAniWidget movement @@ -192,6 +125,17 @@ bloc imgUrl ShowNotificationIcon + isCurrent + isFirst + Navigator + state + key + get + OverlayState + _overlayKey + get + Route + endDrawer @@ -205,7 +149,6 @@ @@ -325,20 +269,6 @@ - - - - - - - - - - - - - - @@ -550,7 +480,7 @@ - + @@ -562,12 +492,12 @@ - + - + @@ -587,7 +517,7 @@ - + @@ -602,12 +532,12 @@ - + - + @@ -632,6 +562,7 @@ file://$PROJECT_DIR$/lib/widget/home_page.dart + 2 @@ -703,48 +634,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -859,6 +748,7 @@ + @@ -897,6 +787,7 @@ + @@ -954,14 +845,6 @@ - - - - - - - - @@ -1007,7 +890,7 @@ - + @@ -1020,14 +903,6 @@ - - - - - - - - @@ -1060,20 +935,12 @@ - - - - - - - - - + @@ -1091,14 +958,82 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/widget/home_page.dart b/lib/widget/home_page.dart index 0657247..12acd4a 100644 --- a/lib/widget/home_page.dart +++ b/lib/widget/home_page.dart @@ -1,9 +1,12 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_study/widget/demo_localizations/localizations_study.dart'; +import 'package:flutter_study/widget/drawer_page.dart'; import 'package:flutter_study/widget/tab_android_page.dart'; import 'package:flutter_study/widget/tab_girl_page.dart'; import 'package:flutter_study/widget/tab_ios_page.dart'; -import 'package:flutter_study/widget/drawer_page.dart'; class HomePage extends StatefulWidget { @override _HomePageState createState() => new _HomePageState(); @@ -13,6 +16,7 @@ class _HomePageState extends State with SingleTickerProviderStateMixin { final _key = new GlobalKey(); + @override void initState() { super.initState(); @@ -38,10 +42,30 @@ class _HomePageState extends State ); } + _showDialog() { + showDialog( + context: context, + child: new AlertDialog(content: new Text('退出app'), actions: [ + new FlatButton( + onPressed: () { + Navigator.pop(context); + Navigator.pop(context); + }, + child: new Text('确定')) + ]), + ); + } + + + Future _requestPop() { + _showDialog(); + return new Future.value(false); + } + @override Widget build(BuildContext context) { _initPage(); - return new Scaffold( + return new WillPopScope(child: new Scaffold( key: _key, appBar: new AppBar( title: new Text(StudyLocalizations.of(context) @@ -69,6 +93,6 @@ class _HomePageState extends State }, ), body: _body, - ); + ), onWillPop: _requestPop); } }