mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-20 06:16:20 +08:00
modify bottom tab
This commit is contained in:
@ -353,7 +353,7 @@
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
|
||||
"${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
|
||||
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
|
10
ios/Runner.xcworkspace/contents.xcworkspacedata
generated
Normal file
10
ios/Runner.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildSystemType</key>
|
||||
<string>Original</string>
|
||||
</dict>
|
||||
</plist>
|
@ -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';
|
||||
@ -36,41 +34,40 @@ class _MyHomePageState extends State<AppPage>
|
||||
SpUtil sp;
|
||||
WidgetControlModel widgetControl = new WidgetControlModel();
|
||||
SearchHistoryList searchHistoryList;
|
||||
TabController controller;
|
||||
bool isSearch = false;
|
||||
String data = '无';
|
||||
String data2ThirdPage = '这是传给ThirdPage的值';
|
||||
String appBarTitle = tabData[0]['text'];
|
||||
List<Widget> 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<Widget> myTabs = [];
|
||||
List<BottomNavigationBarItem> 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();
|
||||
}
|
||||
|
||||
@ -100,7 +97,6 @@ class _MyHomePageState extends State<AppPage>
|
||||
return new SearchInput((value) async {
|
||||
if (value != '') {
|
||||
List<WidgetPoint> list = await widgetControl.search(value);
|
||||
|
||||
return list
|
||||
.map((item) => new MaterialSearchResult<String>(
|
||||
value: item.name,
|
||||
@ -119,52 +115,27 @@ class _MyHomePageState extends State<AppPage>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var db = Provider.db;
|
||||
|
||||
return new Scaffold(
|
||||
appBar: new AppBar(title: buildSearchInput(context)),
|
||||
body: new TabBarView(controller: controller, children: <Widget>[
|
||||
new FirstPage(),
|
||||
new WidgetPage(db),
|
||||
new CollectionPage(),
|
||||
FourthPage()
|
||||
]),
|
||||
bottomNavigationBar: Material(
|
||||
color: const Color(0xFFF0EEEF), //底部导航栏主题颜色
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
height: 65.0,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF0F0F0),
|
||||
boxShadow: <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),
|
||||
),
|
||||
),
|
||||
body: list[_currentIndex],
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: myTabs,
|
||||
//高亮 被点击高亮
|
||||
currentIndex: _currentIndex,
|
||||
//修改 页面
|
||||
onTap: _ItemTapped,
|
||||
//shifting :按钮点击移动效果,超过5个button不支持
|
||||
//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'];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
pubspec.lock
16
pubspec.lock
@ -14,7 +14,7 @@ packages:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.0.8"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -150,7 +150,7 @@ packages:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.5"
|
||||
version: "0.12.3+1"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -171,14 +171,14 @@ packages:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.0"
|
||||
version: "1.4.0"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
version: "2.0.1"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -197,7 +197,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.5"
|
||||
version: "1.5.4"
|
||||
sqflite:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -218,7 +218,7 @@ packages:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "1.6.8"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -246,7 +246,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.5"
|
||||
version: "0.2.2"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -269,5 +269,5 @@ packages:
|
||||
source: hosted
|
||||
version: "2.0.8"
|
||||
sdks:
|
||||
dart: ">=2.2.0 <3.0.0"
|
||||
dart: ">=2.1.0 <3.0.0"
|
||||
flutter: ">=1.2.1 <2.0.0"
|
||||
|
Reference in New Issue
Block a user