2d transforms UX improvements (#30932)
Small usability fixes for pan and zoom demo. Title and instruction dialog.
This commit is contained in:
committed by
GitHub
parent
a8116e9ea3
commit
ec7f3f0956
@@ -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: () {
|
||||
|
||||
Reference in New Issue
Block a user