Last active
May 22, 2019 06:12
-
-
Save termosa/3bdad4ca2dbd42baa6611f3bb09fefe1 to your computer and use it in GitHub Desktop.
[An Introduction to Flutter: The Interface] Simple slider layout
This file contains hidden or 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
| class SliderExample extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Container( | |
| width: 300, | |
| child: Column( | |
| mainAxisSize: MainAxisSize.min, | |
| children: [ | |
| Image.network('http://lorempixel.com/300/200/city/'), | |
| SliderButtons(), | |
| ], | |
| ), | |
| ); | |
| } | |
| } | |
| class SliderButtons extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Container( | |
| padding: EdgeInsets.all(10), | |
| child: Row( | |
| mainAxisAlignment: MainAxisAlignment.spaceAround, | |
| children: [ | |
| SliderButton(label: 'Prev', icon: '←'), | |
| SliderButton(label: 'Next', icon: '→'), | |
| ], | |
| ), | |
| ); | |
| } | |
| } | |
| class SliderButton extends StatelessWidget { | |
| const SliderButton({this.label, this.icon}); | |
| final String label; | |
| final String icon; | |
| @override | |
| Widget build(BuildContext context) { | |
| return Column( | |
| children: [ | |
| Text(icon, style: TextStyle(fontSize: 22)), | |
| Text(label), | |
| ], | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment