-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed0880a
commit 33adff1
Showing
5 changed files
with
412 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../native_app.dart'; | ||
|
||
class InputTriggerPage extends StatefulWidget { | ||
@override | ||
State<InputTriggerPage> createState() => _PickerPageState(); | ||
} | ||
|
||
class _PickerPageState extends State<InputTriggerPage> { | ||
DateTime? selectedDate; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SingleChildScrollView( | ||
padding: const EdgeInsets.symmetric( | ||
vertical: sbbDefaultSpacing, | ||
horizontal: sbbDefaultSpacing * 0.5, | ||
), | ||
child: Column( | ||
children: <Widget>[ | ||
ThemeModeSegmentedButton(), | ||
const SizedBox( | ||
height: sbbDefaultSpacing, | ||
), | ||
SBBGroup( | ||
child: Column( | ||
children: [ | ||
SBBInputTrigger( | ||
maxLines: 1, | ||
value: inputValue, | ||
labelText: labelValue, | ||
hintText: hintValue, | ||
errorText: errorValue, | ||
onPressed: () { | ||
showSBBModalSheet( | ||
context: context, | ||
title: 'Date', | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
SBBDatePicker(onDateChanged: (DateTime date) { | ||
setState(() { | ||
selectedDate = date; | ||
valueController.text = date.toIso8601String(); | ||
}); | ||
}), | ||
], | ||
), | ||
); | ||
}, | ||
prefixIcon: showPrefixIcon ? SBBIcons.dog_small : null, | ||
suffixIcon: showSuffixIcon | ||
? SBBIcons.circle_information_small_small | ||
: null, | ||
onSuffixPressed: () {}, | ||
enabled: enabled, | ||
), | ||
], | ||
), | ||
), | ||
const SizedBox( | ||
height: sbbDefaultSpacing, | ||
), | ||
SBBGroup( | ||
child: Column( | ||
children: [ | ||
SBBTextField( | ||
controller: labelController, | ||
labelText: 'Label', | ||
), | ||
SBBTextField( | ||
controller: hintController, | ||
labelText: 'Hint', | ||
), | ||
SBBTextField( | ||
controller: valueController, | ||
labelText: 'Value', | ||
), | ||
SBBTextField( | ||
controller: errorController, | ||
labelText: 'Error', | ||
), | ||
SBBSwitchListItem( | ||
title: 'Enabled', | ||
value: enabled, | ||
onChanged: (enabled) { | ||
setState(() { | ||
this.enabled = enabled; | ||
}); | ||
}, | ||
), | ||
SBBSwitchListItem( | ||
title: 'Prefix Icon', | ||
value: showPrefixIcon, | ||
onChanged: (enabled) { | ||
setState(() { | ||
this.showPrefixIcon = enabled; | ||
}); | ||
}, | ||
), | ||
SBBSwitchListItem( | ||
title: 'Suffix Icon', | ||
value: showSuffixIcon, | ||
onChanged: (enabled) { | ||
setState(() { | ||
this.showSuffixIcon = enabled; | ||
}); | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
|
||
bool enabled = true; | ||
bool showPrefixIcon = true; | ||
bool showSuffixIcon = true; | ||
String inputValue = ''; | ||
String labelValue = ''; | ||
String hintValue = ''; | ||
String errorValue = ''; | ||
final valueController = TextEditingController(); | ||
final labelController = TextEditingController(); | ||
final hintController = TextEditingController(); | ||
final errorController = TextEditingController(); | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
valueController.addListener(() { | ||
setState(() { | ||
inputValue = valueController.text; | ||
}); | ||
}); | ||
labelController.addListener(() { | ||
setState(() { | ||
labelValue = labelController.text; | ||
}); | ||
}); | ||
hintController.addListener(() { | ||
setState(() { | ||
hintValue = hintController.text; | ||
}); | ||
}); | ||
errorController.addListener(() { | ||
setState(() { | ||
errorValue = errorController.text; | ||
}); | ||
}); | ||
} | ||
} |
This file contains 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
Oops, something went wrong.