diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100644
index 18d98100..00000000
--- a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- IDEDidComputeMac32BitWarning
-
-
-
diff --git a/lib/views/home.dart b/lib/views/home.dart
index 63b22aeb..59dbd737 100644
--- a/lib/views/home.dart
+++ b/lib/views/home.dart
@@ -1,4 +1,3 @@
-
/// Created with Android Studio.
/// User: 三帆
/// Date: 16/01/2019
@@ -6,7 +5,6 @@
/// email: sanfan.hx@alibaba-inc.com
/// target: app首页
-
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_go/utils/shared_preferences.dart';
@@ -22,10 +20,6 @@ import 'package:flutter_go/components/search_input.dart';
import 'package:flutter_go/model/search_history.dart';
import 'package:flutter_go/resources/widget_name_to_icon.dart';
-import './first_page/main_page.dart';
-
-
-
const int ThemeColor = 0xFFC91B3A;
class AppPage extends StatefulWidget {
@@ -40,41 +34,40 @@ class _MyHomePageState extends State
SpUtil sp;
WidgetControlModel widgetControl = new WidgetControlModel();
SearchHistoryList searchHistoryList;
- TabController controller;
bool isSearch = false;
- String data = '无';
- String data2ThirdPage = '这是传给ThirdPage的值';
String appBarTitle = tabData[0]['text'];
+ List list = List();
+ int _currentIndex = 0;
static List tabData = [
- {'text': '业界动态', 'icon': new Icon(Icons.language)},
- {'text': 'WIDGET', 'icon': new Icon(Icons.extension)},
- {'text': '组件收藏', 'icon': new Icon(Icons.favorite)},
- {'text': '关于手册', 'icon': new Icon(Icons.import_contacts)}
+ {'text': '业界动态', 'icon': Icon(Icons.language)},
+ {'text': 'WIDGET', 'icon': Icon(Icons.extension)},
+ {'text': '组件收藏', 'icon': Icon(Icons.favorite)},
+ {'text': '关于手册', 'icon': Icon(Icons.import_contacts)}
];
- List myTabs = [];
+ List myTabs = [];
@override
void initState() {
super.initState();
-
initSearchHistory();
- controller = new TabController(
- initialIndex: 0, vsync: this, length: 4); // 这里的length 决定有多少个底导 submenus
for (int i = 0; i < tabData.length; i++) {
- myTabs.add(new Tab(text: tabData[i]['text'], icon: tabData[i]['icon']));
+ myTabs.add(BottomNavigationBarItem(
+ icon: tabData[i]['icon'],
+ title: Text(
+ tabData[i]['text'],
+ ),
+ ));
}
- controller.addListener(() {
- if (controller.indexIsChanging) {
- _onTabChange();
- }
- });
- Application.controller = controller;
+ list
+ ..add(FirstPage())
+ ..add(WidgetPage(Provider.db))
+ ..add(CollectionPage())
+ ..add(FourthPage());
}
@override
void dispose() {
- controller.dispose();
super.dispose();
}
@@ -106,7 +99,6 @@ class _MyHomePageState extends State
return new SearchInput((value) async {
if (value != '') {
List list = await widgetControl.search(value);
-
return list
.map((item) => new MaterialSearchResult(
value: item.name,
@@ -123,63 +115,31 @@ class _MyHomePageState extends State
}, (value) {}, () {});
}
- renderAppBar(BuildContext context,Widget widget) {
- print('renderAppBar=====>>>>>>${controller.index}');
- if(controller.index == 0) {
- return null;
- }
- return AppBar(title: buildSearchInput(context));
- }
@override
Widget build(BuildContext context) {
- var db = Provider.db;
-
return new Scaffold(
- appBar: renderAppBar(context,widget),
- body: new TabBarView(controller: controller, children: [
- //new FirstPage(),
- MainPage(),
- WidgetPage(db),
- CollectionPage(),
- FourthPage()
- ]),
- bottomNavigationBar: Material(
- color: const Color(0xFFF0EEEF), //底部导航栏主题颜色
- child: SafeArea(
- child: Container(
- height: 65.0,
- decoration: BoxDecoration(
- color: const Color(0xFFF0F0F0),
- boxShadow: [
- BoxShadow(
- color: const Color(0xFFd0d0d0),
- blurRadius: 3.0,
- spreadRadius: 2.0,
- offset: Offset(-1.0, -1.0),
- ),
- ],
- ),
- child: TabBar(
- controller: controller,
- indicatorColor: Theme.of(context).primaryColor,
- //tab标签的下划线颜色
- // labelColor: const Color(0xFF000000),
- indicatorWeight: 3.0,
- labelColor: Theme.of(context).primaryColor,
- unselectedLabelColor: const Color(0xFF8E8E8E),
- tabs: myTabs),
- ),
- ),
+ appBar: new AppBar(title: buildSearchInput(context)),
+ body: list[_currentIndex],
+ bottomNavigationBar: BottomNavigationBar(
+ items: myTabs,
+ //高亮 被点击高亮
+ currentIndex: _currentIndex,
+ //修改 页面
+ onTap: _ItemTapped,
+ //shifting :按钮点击移动效果
+ //fixed:固定
+ type: BottomNavigationBarType.fixed,
+
+ fixedColor: Color(0xFFC91B3A),
),
);
}
- void _onTabChange() {
- if (this.mounted) {
- this.setState(() {
- appBarTitle = tabData[controller.index]['text'];
- });
- }
+ void _ItemTapped(int index) {
+ setState(() {
+ _currentIndex = index;
+ appBarTitle = tabData[index]['text'];
+ });
}
}
diff --git a/pubspec.lock b/pubspec.lock
index 572ec55d..e6e3e04f 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -51,12 +51,12 @@ packages:
source: hosted
version: "1.14.11"
cookie_jar:
- dependency: transitive
+ dependency: "direct main"
description:
name: cookie_jar
url: "https://pub.flutter-io.cn"
source: hosted
- version: "0.0.8"
+ version: "1.0.0"
csslib:
dependency: transitive
description:
@@ -77,7 +77,7 @@ packages:
name: dio
url: "https://pub.flutter-io.cn"
source: hosted
- version: "1.0.17"
+ version: "2.1.3"
event_bus:
dependency: "direct main"
description:
@@ -200,6 +200,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.2"
+ path_provider:
+ dependency: "direct main"
+ description:
+ name: path_provider
+ url: "https://pub.flutter-io.cn"
+ source: hosted
+ version: "1.0.0"
pedantic:
dependency: transitive
description: