forked from firka/flutter
Make the full-screen dialog text editable in gallery (#13690)
This commit is contained in:
committed by
Hans Muller
parent
254c45e471
commit
03a0cd25a5
@@ -106,8 +106,12 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
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 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
|
||||
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 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user