Created
April 2, 2020 16:50
-
-
Save ibcoleman/c6b38c2a9086f57d86a8a0bf877326ea to your computer and use it in GitHub Desktop.
Flutter UI
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 _MyHomePageState extends State<MyHomePage> { | |
int _counter = 0; | |
void _incrementCounter() { | |
setState(() { | |
_counter++; | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
_barcodeInfoSection(), | |
], | |
), | |
), | |
floatingActionButton: FloatingActionButton( | |
onPressed: _incrementCounter, | |
tooltip: 'Increment', | |
child: Icon(Icons.add), | |
), // This trailing comma makes auto-formatting nicer for build methods. | |
); | |
} | |
_getFlexibleRow(String label, String value) { | |
return Flexible( | |
child: Row( | |
children: [ | |
Expanded( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [Text(label, textAlign: TextAlign.left)])), | |
Expanded( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [Text(value, textAlign: TextAlign.right)])), | |
], | |
), | |
); | |
} | |
_barcodeInfoSection() { | |
return Container( | |
child: Column( | |
children: [ | |
Container( | |
padding: const EdgeInsets.all(19), | |
child: Column( | |
mainAxisSize: MainAxisSize.min, | |
children: [ | |
_getFlexibleRow("TCN", "TCN123456789"), | |
_getFlexibleRow("QTY", "22"), | |
_getFlexibleRow("CST", "\$32.99"), | |
_getFlexibleRow("PRT", "P-3828383283"), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment