Unverified Commit ec7f3f09 authored by Justin McCandless's avatar Justin McCandless Committed by GitHub

2d transforms UX improvements (#30932)

Small usability fixes for pan and zoom demo. Title and instruction dialog.
parent a8116e9e
......@@ -35,7 +35,21 @@ class _TransformationsDemoState extends State<TransformationsDemo> {
// The scene is drawn by a CustomPaint, but user interaction is handled by
// the GestureTransformable parent widget.
return Scaffold(
appBar: AppBar(),
appBar: AppBar(
title: const Text('2D Tranformations'),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.help),
tooltip: 'Help',
onPressed: () {
showDialog<Column>(
context: context,
builder: (BuildContext context) => instructionDialog,
);
},
),
],
),
body: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
// Draw the scene as big as is available, but allow the user to
......@@ -71,6 +85,31 @@ class _TransformationsDemoState extends State<TransformationsDemo> {
);
}
Widget get instructionDialog {
return AlertDialog(
title: const Text('2D Transformations'),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
Text('Tap to edit hex tiles, and use gestures to move around the scene:\n'),
Text('- Drag to pan.'),
Text('- Pinch to zoom.'),
Text('- Rotate with two fingers.'),
Text('\nYou can always press the home button to return to the starting orientation!'),
],
),
actions: <Widget>[
FlatButton(
child: const Text('OK'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
}
FloatingActionButton get resetButton {
return FloatingActionButton(
onPressed: () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment