Created
March 9, 2018 09:21
-
-
Save boldijar/27f4d2eb621a09a69d5aabc874072043 to your computer and use it in GitHub Desktop.
Sample cod for issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
typedef double GetOffsetMethod(); | |
typedef void SetOffsetMethod(double offset); | |
class DebugUiPage extends StatefulWidget { | |
DebugUiPage({Key key}) : super(key: key); | |
@override | |
_DebugUiPageState createState() => new _DebugUiPageState(); | |
} | |
class _DebugUiPageState extends State<DebugUiPage> | |
with SingleTickerProviderStateMixin { | |
PageController _pageController; | |
int _page = 0; | |
@override | |
void initState() { | |
super.initState(); | |
_pageController = new PageController(); | |
} | |
@override | |
void dispose() { | |
_pageController.dispose(); | |
super.dispose(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: new AppBar( | |
title: new Text("Hello") | |
), | |
bottomNavigationBar: new BottomNavigationBar( | |
items: [ | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.map), | |
title: new Text("Lorem") | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.pin_drop), | |
title: new Text("Borem") | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.people), | |
title: new Text("Ipsum") | |
) | |
], | |
currentIndex: _page, | |
onTap: navigationTapped, | |
), | |
body: new PageView( | |
onPageChanged: onPageChanged, | |
controller: _pageController, | |
children: <Widget>[ | |
new ListView.builder(itemBuilder: getBuilder, itemCount: 100), | |
new Container(color: Colors.yellow), | |
new Container(color: Colors.blue) | |
] | |
) | |
); | |
} | |
void navigationTapped(int index) { | |
_pageController.animateToPage( | |
index, | |
duration: const Duration(milliseconds: 300), | |
curve: Curves.ease | |
); | |
} | |
void onPageChanged(int value) { | |
setState(() { | |
this._page = value; | |
}); | |
} | |
} | |
Widget getBuilder(BuildContext context, int index) { | |
return new Card( | |
child: new Container( | |
padding: new EdgeInsets.all(16.0), | |
child: new Text("Item value $index") | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment