Make full-screen dialog text editable in gallery (#13690) (#15732) Make the full-screen dialog text editable in gallery (#13690)
diff --git a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart index d44263b..91d5802 100644 --- a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart
@@ -106,8 +106,12 @@ DateTime _toDateTime = new DateTime.now(); bool _allDayValue = false; bool _saveNeeded = false; + bool _hasLocation = false; + bool _hasName = false; + String _eventName; Future<bool> _onWillPop() async { + _saveNeeded = _hasLocation || _hasName || _saveNeeded; if (!_saveNeeded) return true; @@ -147,7 +151,7 @@ return new Scaffold( appBar: new AppBar( - title: const Text('New event'), + title: new Text(_hasName ? _eventName : 'Event Name TBD'), actions: <Widget> [ new FlatButton( child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)), @@ -164,19 +168,38 @@ children: <Widget>[ new Container( padding: const EdgeInsets.symmetric(vertical: 8.0), - decoration: new BoxDecoration( - border: new Border(bottom: new BorderSide(color: theme.dividerColor)) - ), alignment: Alignment.bottomLeft, - child: new Text('Event name', style: theme.textTheme.display2) + child: new TextField( + decoration: const InputDecoration( + labelText: 'Event name', + filled: true + ), + style: theme.textTheme.headline, + onChanged: (String value) { + setState(() { + _hasName = value.isNotEmpty; + if (_hasName) { + _eventName = value; + } + }); + } + ) ), new Container( padding: const EdgeInsets.symmetric(vertical: 8.0), - decoration: new BoxDecoration( - border: new Border(bottom: new BorderSide(color: theme.dividerColor)) - ), alignment: Alignment.bottomLeft, - child: new Text('Location', style: theme.textTheme.title.copyWith(color: Colors.black54)) + child: new TextField( + decoration: const InputDecoration( + labelText: 'Location', + hintText: 'Where is the event?', + filled: true + ), + onChanged: (String value) { + setState(() { + _hasLocation = value.isNotEmpty; + }); + } + ) ), new Column( crossAxisAlignment: CrossAxisAlignment.start,