Skip to content

Commit

Permalink
Add volume slider in example app
Browse files Browse the repository at this point in the history
  • Loading branch information
gdelataillade committed Oct 4, 2023
1 parent 0ede014 commit a79cab7
Showing 1 changed file with 39 additions and 13 deletions.
52 changes: 39 additions & 13 deletions example/lib/screens/edit_alarm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,6 @@ class _ExampleAlarmEditScreenState extends State<ExampleAlarmEditScreen> {
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'System volume max',
style: Theme.of(context).textTheme.titleMedium,
),
Switch(
value: volume != null,
onChanged: (value) => setState(() => volume = value ? 1 : null),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand Down Expand Up @@ -257,6 +244,45 @@ class _ExampleAlarmEditScreenState extends State<ExampleAlarmEditScreen> {
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Custom volume',
style: Theme.of(context).textTheme.titleMedium,
),
Switch(
value: volume != null,
onChanged: (value) =>
setState(() => volume = value ? 0.5 : null),
),
],
),
SizedBox(
height: 30,
child: volume != null
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(
volume! > 0.7
? Icons.volume_up_rounded
: volume! > 0.1
? Icons.volume_down_rounded
: Icons.volume_mute_rounded,
),
Expanded(
child: Slider(
value: volume!,
onChanged: (value) {
setState(() => volume = value);
},
),
),
],
)
: const SizedBox(),
),
if (!creating)
TextButton(
onPressed: deleteAlarm,
Expand Down

0 comments on commit a79cab7

Please sign in to comment.