Skip to content

Commit

Permalink
Merge pull request #1 from iteatimeteam/master
Browse files Browse the repository at this point in the history
添加不带动画的加号
  • Loading branch information
XuYanci authored Jul 22, 2019
2 parents fd08099 + 54354b2 commit d2443b9
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 84 deletions.
Binary file added images/post_highlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/post_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* 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 @@ -41,7 +40,6 @@
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 @@ -75,7 +73,6 @@
children = (
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
Expand Down Expand Up @@ -188,7 +185,6 @@
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
96 changes: 73 additions & 23 deletions lib/TapWaterTabbar.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import 'package:flutter/material.dart';
import 'firstvc.dart';

enum ActionsItems {
Group_chat,
Add_friend,
Scan,
Payment,
}
//enum ActionsItems {
// Group_chat,
// Add_friend,
// Scan,
// Payment,
//}

class NavigationIconView {
final BottomNavigationBarItem item;

NavigationIconView({
Key key,
String title,
Expand All @@ -34,7 +33,9 @@ class _TapWaterTabbarState extends State<TapWaterTabbar> {
int _currentIndex = 0;
List<NavigationIconView> _navgationViews;
List<Widget> _pages;

//添加图片地址,需要动态更换图片
String bigImg = 'images/post_normal.png';
int page = 0;
@override
void initState() {
super.initState();
Expand All @@ -47,20 +48,27 @@ class _TapWaterTabbarState extends State<TapWaterTabbar> {
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.email),
avtiveIcon: Icon(Icons.drive_eta),
)

];

_pageController = PageController(initialPage: _currentIndex);
_pages = [
DemoWidget("first"),
DemoWidget("two"),
DemoWidget("five"),
DemoWidget("three"),
DemoWidget("four"),
];
Expand All @@ -71,7 +79,7 @@ class _TapWaterTabbarState extends State<TapWaterTabbar> {
children: <Widget>[
icon,
Container(
width: 3,
width: 20,
),
Text(
title,
Expand All @@ -85,27 +93,24 @@ 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: (int index) {
setState(() {
_currentIndex = index;
_pageController.animateToPage(
_currentIndex,
duration: Duration(milliseconds: 200),
curve: Curves.easeInOut,
);
});
print('点击了第$index');
},
onTap: onTap,
);

return Scaffold(
return MaterialApp(
theme: ThemeData(primaryColor: Colors.blue),
home: Scaffold(
body: Stack(
children: <Widget>[
Scaffold(
appBar: AppBar(
elevation: 0.0,
title: Text('微信'),
Expand Down Expand Up @@ -179,6 +184,51 @@ class _TapWaterTabbarState extends State<TapWaterTabbar> {
},
),
bottomNavigationBar: botNavbar,

),
Align(
child: Padding(
padding: const EdgeInsets.only(bottom:50.0),
child: FloatingActionButton(
child: new Image.asset(bigImg),
onPressed: onBigImgTap,
),
),
alignment: Alignment.bottomCenter,
),
],
)
)
);

}
void onTap(int index) {
if (index != 2) {
setState(() {
this.bigImg = 'images/post_normal.png';
});
}else{
setState(() {
this.bigImg = 'images/post_highlight.png';
});
}

_pageController.jumpToPage(index);
}

//添加图片的点击事件
void onBigImgTap() {
setState(() {
this.page = 2;
this.bigImg = 'images/post_highlight.png';
onTap(2);
});
}

void onPageChanged(int page) {
setState(() {
this.page = page;
});
}

}
114 changes: 57 additions & 57 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,60 @@ class MyApp extends StatelessWidget {
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

const Color ContentColor = Color.fromARGB(255, 170, 170, 170);

Widget contentWidget({double height}) {
return Container(
margin: const EdgeInsets.all(10),
color: Color.fromARGB(255, 170, 170, 170),
width: 25,
height: height,
);
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Listener(
onPointerDown: (PointerDownEvent event) {
print('Gesture3');
},
child: SizedBox(
width: 200,
height: 200,
child: GestureDetector(
onTap: () {
print('Gesture2');
},
child: SizedBox(
width: 100,
height: 100,
child: Listener(
onPointerDown: (PointerDownEvent event) {
print('Gesture1');
},
child: SizedBox(
width: 50,
height: 50,
),
),
),
),
),
),
);
}
}
//class MyHomePage extends StatefulWidget {
// MyHomePage({Key key, this.title}) : super(key: key);
//
// final String title;
//
// @override
// _MyHomePageState createState() => _MyHomePageState();
//}
//
//const Color ContentColor = Color.fromARGB(255, 170, 170, 170);
//
//Widget contentWidget({double height}) {
// return Container(
// margin: const EdgeInsets.all(10),
// color: Color.fromARGB(255, 170, 170, 170),
// width: 25,
// height: height,
// );
//}
//
//class _MyHomePageState extends State<MyHomePage> {
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: Text(widget.title),
// ),
// body: Listener(
// onPointerDown: (PointerDownEvent event) {
// print('Gesture3');
// },
// child: SizedBox(
// width: 200,
// height: 200,
// child: GestureDetector(
// onTap: () {
// print('Gesture2');
// },
// child: SizedBox(
// width: 100,
// height: 100,
// child: Listener(
// onPointerDown: (PointerDownEvent event) {
// print('Gesture1');
// },
// child: SizedBox(
// width: 50,
// height: 50,
// ),
// ),
// ),
// ),
// ),
// ),
// );
// }
//}
4 changes: 4 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
flutter:
sdk: flutter


dev_dependencies:
flutter_test:
sdk: flutter
Expand All @@ -24,3 +25,6 @@ flutter:
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- images/post_normal.png
- images/post_highlight.png

0 comments on commit d2443b9

Please sign in to comment.