Skip to content

Commit 802980f

Browse files
committed
session 验证
2 parents 4ac0bc2 + e98fa6d commit 802980f

File tree

3 files changed

+46
-87
lines changed

3 files changed

+46
-87
lines changed

ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/views/home.dart

Lines changed: 36 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
21
/// Created with Android Studio.
32
/// User: 三帆
43
/// Date: 16/01/2019
54
/// Time: 11:16
65
76
/// target: app首页
87
9-
108
import 'package:flutter/material.dart';
119
import 'package:flutter/rendering.dart';
1210
import 'package:flutter_go/utils/shared_preferences.dart';
@@ -22,10 +20,6 @@ import 'package:flutter_go/components/search_input.dart';
2220
import 'package:flutter_go/model/search_history.dart';
2321
import 'package:flutter_go/resources/widget_name_to_icon.dart';
2422

25-
import './first_page/main_page.dart';
26-
27-
28-
2923
const int ThemeColor = 0xFFC91B3A;
3024

3125
class AppPage extends StatefulWidget {
@@ -40,41 +34,40 @@ class _MyHomePageState extends State<AppPage>
4034
SpUtil sp;
4135
WidgetControlModel widgetControl = new WidgetControlModel();
4236
SearchHistoryList searchHistoryList;
43-
TabController controller;
4437
bool isSearch = false;
45-
String data = '无';
46-
String data2ThirdPage = '这是传给ThirdPage的值';
4738
String appBarTitle = tabData[0]['text'];
39+
List<Widget> list = List();
40+
int _currentIndex = 0;
4841
static List tabData = [
49-
{'text': '业界动态', 'icon': new Icon(Icons.language)},
50-
{'text': 'WIDGET', 'icon': new Icon(Icons.extension)},
51-
{'text': '组件收藏', 'icon': new Icon(Icons.favorite)},
52-
{'text': '关于手册', 'icon': new Icon(Icons.import_contacts)}
42+
{'text': '业界动态', 'icon': Icon(Icons.language)},
43+
{'text': 'WIDGET', 'icon': Icon(Icons.extension)},
44+
{'text': '组件收藏', 'icon': Icon(Icons.favorite)},
45+
{'text': '关于手册', 'icon': Icon(Icons.import_contacts)}
5346
];
5447

55-
List<Widget> myTabs = [];
48+
List<BottomNavigationBarItem> myTabs = [];
5649

5750
@override
5851
void initState() {
5952
super.initState();
60-
6153
initSearchHistory();
62-
controller = new TabController(
63-
initialIndex: 0, vsync: this, length: 4); // 这里的length 决定有多少个底导 submenus
6454
for (int i = 0; i < tabData.length; i++) {
65-
myTabs.add(new Tab(text: tabData[i]['text'], icon: tabData[i]['icon']));
55+
myTabs.add(BottomNavigationBarItem(
56+
icon: tabData[i]['icon'],
57+
title: Text(
58+
tabData[i]['text'],
59+
),
60+
));
6661
}
67-
controller.addListener(() {
68-
if (controller.indexIsChanging) {
69-
_onTabChange();
70-
}
71-
});
72-
Application.controller = controller;
62+
list
63+
..add(FirstPage())
64+
..add(WidgetPage(Provider.db))
65+
..add(CollectionPage())
66+
..add(FourthPage());
7367
}
7468

7569
@override
7670
void dispose() {
77-
controller.dispose();
7871
super.dispose();
7972
}
8073

@@ -106,7 +99,6 @@ class _MyHomePageState extends State<AppPage>
10699
return new SearchInput((value) async {
107100
if (value != '') {
108101
List<WidgetPoint> list = await widgetControl.search(value);
109-
110102
return list
111103
.map((item) => new MaterialSearchResult<String>(
112104
value: item.name,
@@ -123,63 +115,31 @@ class _MyHomePageState extends State<AppPage>
123115
}, (value) {}, () {});
124116
}
125117

126-
renderAppBar(BuildContext context,Widget widget) {
127-
print('renderAppBar=====>>>>>>${controller.index}');
128-
if(controller.index == 0) {
129-
return null;
130-
}
131-
return AppBar(title: buildSearchInput(context));
132-
}
133118

134119
@override
135120
Widget build(BuildContext context) {
136-
var db = Provider.db;
137-
138121
return new Scaffold(
139-
appBar: renderAppBar(context,widget),
140-
body: new TabBarView(controller: controller, children: <Widget>[
141-
//new FirstPage(),
142-
MainPage(),
143-
WidgetPage(db),
144-
CollectionPage(),
145-
FourthPage()
146-
]),
147-
bottomNavigationBar: Material(
148-
color: const Color(0xFFF0EEEF), //底部导航栏主题颜色
149-
child: SafeArea(
150-
child: Container(
151-
height: 65.0,
152-
decoration: BoxDecoration(
153-
color: const Color(0xFFF0F0F0),
154-
boxShadow: <BoxShadow>[
155-
BoxShadow(
156-
color: const Color(0xFFd0d0d0),
157-
blurRadius: 3.0,
158-
spreadRadius: 2.0,
159-
offset: Offset(-1.0, -1.0),
160-
),
161-
],
162-
),
163-
child: TabBar(
164-
controller: controller,
165-
indicatorColor: Theme.of(context).primaryColor,
166-
//tab标签的下划线颜色
167-
// labelColor: const Color(0xFF000000),
168-
indicatorWeight: 3.0,
169-
labelColor: Theme.of(context).primaryColor,
170-
unselectedLabelColor: const Color(0xFF8E8E8E),
171-
tabs: myTabs),
172-
),
173-
),
122+
appBar: new AppBar(title: buildSearchInput(context)),
123+
body: list[_currentIndex],
124+
bottomNavigationBar: BottomNavigationBar(
125+
items: myTabs,
126+
//高亮 被点击高亮
127+
currentIndex: _currentIndex,
128+
//修改 页面
129+
onTap: _ItemTapped,
130+
//shifting :按钮点击移动效果
131+
//fixed:固定
132+
type: BottomNavigationBarType.fixed,
133+
134+
fixedColor: Color(0xFFC91B3A),
174135
),
175136
);
176137
}
177138

178-
void _onTabChange() {
179-
if (this.mounted) {
180-
this.setState(() {
181-
appBarTitle = tabData[controller.index]['text'];
182-
});
183-
}
139+
void _ItemTapped(int index) {
140+
setState(() {
141+
_currentIndex = index;
142+
appBarTitle = tabData[index]['text'];
143+
});
184144
}
185145
}

pubspec.lock

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ packages:
5151
source: hosted
5252
version: "1.14.11"
5353
cookie_jar:
54-
dependency: transitive
54+
dependency: "direct main"
5555
description:
5656
name: cookie_jar
5757
url: "https://pub.flutter-io.cn"
5858
source: hosted
59-
version: "0.0.8"
59+
version: "1.0.0"
6060
csslib:
6161
dependency: transitive
6262
description:
@@ -77,7 +77,7 @@ packages:
7777
name: dio
7878
url: "https://pub.flutter-io.cn"
7979
source: hosted
80-
version: "1.0.17"
80+
version: "2.1.3"
8181
event_bus:
8282
dependency: "direct main"
8383
description:
@@ -200,6 +200,13 @@ packages:
200200
url: "https://pub.flutter-io.cn"
201201
source: hosted
202202
version: "1.6.2"
203+
path_provider:
204+
dependency: "direct main"
205+
description:
206+
name: path_provider
207+
url: "https://pub.flutter-io.cn"
208+
source: hosted
209+
version: "1.0.0"
203210
pedantic:
204211
dependency: transitive
205212
description:

0 commit comments

Comments
 (0)