Skip to content

Instantly share code, notes, and snippets.

@termosa
Last active May 22, 2019 06:12
Show Gist options
  • Select an option

  • Save termosa/3bdad4ca2dbd42baa6611f3bb09fefe1 to your computer and use it in GitHub Desktop.

Select an option

Save termosa/3bdad4ca2dbd42baa6611f3bb09fefe1 to your computer and use it in GitHub Desktop.
[An Introduction to Flutter: The Interface] Simple slider layout
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