Skip to content

Commit

Permalink
Merge pull request #1 from iteatimeteam/master
Browse files Browse the repository at this point in the history
merge from fork origin
  • Loading branch information
XuYanci authored Jul 25, 2019
2 parents 1a1fc58 + 1c36334 commit 3277f2d
Show file tree
Hide file tree
Showing 8 changed files with 372 additions and 137 deletions.
10 changes: 8 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@

## CheckList


Thanks for considering to this repository. Before you submit your issue, please confirm these boxes are checked.

- [ ] I have read [[EN]Style guide for Flutter repo [CN]Flutter项目代码规范、规约选型》](https://github.com/iteatimeteam/tap_water/issues/1).
- [ ] 我遵守以下 Merge 规则:PR提交后,邀请群组中任意一人进行 review,即可合并。让 reviewer 在 PR 所在页面写下 review 意见表示通过,即可合并。最简单写一句 LGTM 也可以。不按照本规则执行,自己 PR 自己 Merge 并引入问题,会被收回 Merge 权限。
- [ ] [EN]I have added screenshots for main devices if this PR includes UI updates. [CN]UI改动,需要将主要设备截图,表明本此 PR 的 UI 改动。
- [ ] [CN]我遵守以下 Merge 规则:PR 提交后,邀请群组中任意一人进行 review,即可合并。让 reviewer 在 PR 所在页面写下 review 意见表示通过,即可合并。最简单写一句 LGTM 也可以。不按照本规则执行,自己 PR 自己 Merge 并引入问题,会被收回 Merge 权限。如无 merge 权限,请联系 @ChenYilong 执行 merge 操作。

## screenshots

iPhoneX+ | iPhone (except for iPhoneX+) | android
:-------------:|:-------------:|:-------------:
![](http://ww2.sinaimg.cn/large/006tNc79gy1g544k1fcdjg30b20kzn2q.gif) | ![](http://ww1.sinaimg.cn/large/006tNc79gy1g5bvpae0u8j30ku112dj9.jpg) | ![](http://ww3.sinaimg.cn/large/006tNc79gy1g5bv6com75j30ks11sjsh.jpg)



Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ updated

演示 | 主要代码贡献方及介绍
:-------------:|:-------------:
| ![](http://ww2.sinaimg.cn/large/006tNc79gy1g544k1fcdjg30b20kzn2q.gif) | <a href="https://github.com/DargonLee"><img src="https://avatars1.githubusercontent.com/u/13093607?s=400&v=4"></a> </p>[**@DargonLee**]( https://github.com/DargonLee ) </p>[《TabBar基础版本,不带加号按钮 issue#11]( https://github.com/iteatimeteam/tap_water/issues/11 )
![](http://ww4.sinaimg.cn/large/006tNc79gy1g59kad16rdg30b20kzn29.gif) | <a href="https://github.com/SuXiaoya"><img src="https://avatars1.githubusercontent.com/u/11497470?s=400&v=4"></a></p> [@苏筱雅]( https://github.com/SuXiaoya ) </p> [《TabBar 加号按钮未封装版本,带加号按钮 #8]( https://github.com/iteatimeteam/tap_water/issues/8 )
![](http://ww2.sinaimg.cn/large/006tNc79gy1g544k1fcdjg30b20kzn2q.gif) | <a href="https://github.com/DargonLee"><img src="https://avatars1.githubusercontent.com/u/13093607?s=400&v=4"></a> </p>[**@DargonLee**]( https://github.com/DargonLee ) </p>[《TabBar基础版本,不带加号按钮 issue#11]( https://github.com/iteatimeteam/tap_water/issues/11)
![](http://ww2.sinaimg.cn/large/006tNc79gy1g5by04hgd9g30b20kz786.gif) | <a href="https://github.com/SuXiaoya"><img src="https://avatars1.githubusercontent.com/u/11497470?s=400&v=4"></a></p> [@苏筱雅]( https://github.com/SuXiaoya ) </p> [《TabBar 加号按钮未封装版本,带加号按钮 #8]( https://github.com/iteatimeteam/tap_water/issues/8 )

4 changes: 4 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
Expand Down Expand Up @@ -40,6 +41,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -73,6 +75,7 @@
children = (
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
Expand Down Expand Up @@ -185,6 +188,7 @@
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
Expand Down
74 changes: 21 additions & 53 deletions lib/TapWaterTabbar.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/** 该页面以废弃 */

import 'package:flutter/material.dart';
import 'package:tap_water_tab_bar/tab_item.dart';
import 'package:tap_water_tab_bar/tap_water_tab_bar.dart';

import 'firstvc.dart';
Expand Down Expand Up @@ -27,18 +30,18 @@ class NavigationIconView {

class TapWaterTabbar extends StatefulWidget {
final bool isButton;
final List<Map<String, dynamic>> btmNavbar;
TapWaterTabbar({this.btmNavbar, this.isButton = false}) {
final int _len = this.btmNavbar.length;
// final int _len = 5;
if (this.isButton) {
if (_len % 2 == 0) {
this.btmNavbar.insert(_len ~/ 2, null);
} else {
this.btmNavbar.insert(_len ~/ 2 + 1, null);
this.btmNavbar.insert(_len ~/ 2 + 2, null);
}
}
final List<TabItem> tabItems;
TapWaterTabbar({this.tabItems, this.isButton = false}) {
// final int _len = this.btmNavbar.length;
// // final int _len = 5;
// if (this.isButton) {
// if (_len % 2 == 0) {
// this.btmNavbar.insert(_len ~/ 2, null);
// } else {
// this.btmNavbar.insert(_len ~/ 2 + 1, null);
// this.btmNavbar.insert(_len ~/ 2 + 2, null);
// }
// }
}

@override
Expand All @@ -56,27 +59,6 @@ class _TapWaterTabbarState extends State<TapWaterTabbar> {
@override
void initState() {
super.initState();
_navgationViews = [
NavigationIconView(
title: '微信',
icon: Icon(Icons.ac_unit),
avtiveIcon: Icon(Icons.backspace)),
NavigationIconView(
title: '通讯录',
icon: Icon(Icons.backup),
avtiveIcon: Icon(Icons.cached)),
NavigationIconView(
title: '', icon: Icon(Icons.publish), avtiveIcon: Icon(Icons.public)),
NavigationIconView(
title: '发现',
icon: Icon(Icons.dashboard),
avtiveIcon: Icon(Icons.edit)),
NavigationIconView(
title: '我的',
icon: Icon(Icons.memory),
avtiveIcon: Icon(Icons.drive_eta),
)
];

_pageController = PageController(initialPage: _currentIndex);
_pages = [
Expand Down Expand Up @@ -107,15 +89,6 @@ class _TapWaterTabbarState extends State<TapWaterTabbar> {

@override
Widget build(BuildContext context) {
final botNavbar = new BottomNavigationBar(
fixedColor: Colors.green,
items: _navgationViews
.map((NavigationIconView navigationView) => navigationView.item)
.toList(),
currentIndex: _currentIndex,
type: BottomNavigationBarType.fixed,
onTap: onTap,
);
return Scaffold(
appBar: AppBar(
elevation: 0.0,
Expand Down Expand Up @@ -197,18 +170,13 @@ class _TapWaterTabbarState extends State<TapWaterTabbar> {
Align(
alignment: Alignment.bottomCenter,
child: WaterTabBar(
isButton: widget.isButton, btmNavbar: widget.btmNavbar),
isButton: widget.isButton,
tabItemInfos: widget.tabItems,
selectedCallback: (int index) {
print(index);
},
),
),
// Align(
// child: Padding(
// padding: const EdgeInsets.only(bottom: 50.0),
// child: FloatingActionButton(
// child: new Image.asset(bigImg),
// onPressed: onBigImgTap,
// ),
// ),
// alignment: Alignment.bottomCenter,
// ),
],
),
);
Expand Down
98 changes: 85 additions & 13 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,24 +1,96 @@
import 'package:flutter/material.dart';

import 'TapWaterTabbar.dart';
import 'widget/navigation_bar.dart';
// import 'TapWaterTabbar.dart';
import 'tap_water_tab_bar.dart';
import './tab_item.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
// This widget is the root of your application.

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: TapWaterTabbar(isButton: true, btmNavbar: [
{'title': '微信', 'icon': Icon(Icons.ac_unit)},
{'title': '微信', 'icon': Icon(Icons.ac_unit)},
{'title': '微信', 'icon': Icon(Icons.ac_unit)},
{'title': '微信', 'icon': Icon(Icons.ac_unit)}
]),
);
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: _MyAppPage());
}
}

class _MyAppPage extends StatefulWidget {
_MyAppPage({Key key}) : super(key: key);

@override
_MyAppPageState createState() => new _MyAppPageState();
}

class _MyAppPageState extends State<_MyAppPage> {
int _index = 0;
var _pages = [
Align(
alignment: Alignment.center,
child: Text('页面1'),
),
Align(
alignment: Alignment.center,
child: Text('页面2'),
),
Align(
alignment: Alignment.center,
child: Text('页面3'),
),
Align(
alignment: Alignment.center,
child: Text('页面4'),
),
Align(
alignment: Alignment.center,
child: Text('页面5'),
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: NavigationBar(),
body: Stack(
children: <Widget>[
_pages[_index],
WaterTabBar(
isButton: true,
btmNavbar: [
TabItemInfo(
title: '微信1',
icon: Icons.ac_unit,
activeIcon: Icons.backspace,
selectedColor: Colors.green),
TabItemInfo(
title: '微信2',
icon: Icons.ac_unit,
activeIcon: Icons.cached,
selectedColor: Colors.green),
TabItemInfo(
title: '微信3',
icon: Icons.ac_unit,
activeIcon: Icons.edit,
selectedColor: Colors.green),
TabItemInfo(
title: '微信4',
icon: Icons.ac_unit,
activeIcon: Icons.cached,
selectedColor: Colors.green),
],
onTabClick: onTabClick),
],
));
}

void onTabClick(TabItemInfo node) {
setState(() {
_index = node.index;
});
print('$node');
}
}
Loading

0 comments on commit 3277f2d

Please sign in to comment.