Skip to content

Commit

Permalink
Fix edit time
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsreichardt committed May 7, 2022
1 parent 0e79b43 commit f755c18
Showing 1 changed file with 41 additions and 30 deletions.
71 changes: 41 additions & 30 deletions app/lib/timetable/src/edit_time.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,49 @@ class EditTimeField extends StatelessWidget {
top: 6,
bottom: 6,
),
child: ValueListenableBuilder<bool>(
valueListenable: isSelected,
builder: (context, value, _) {
return InkWell(
child: InputDecorator(
isEmpty: time == null,
isFocused: value,
decoration: InputDecoration(
labelText: label,
icon: const Icon(Icons.access_time),
border: const OutlineInputBorder(),
),
child: Align(
alignment: Alignment.centerLeft,
child: SizedBox(
height: 18,
child: time == null
? Container()
: Text(time.toTimeOfDay().format(context),
style: TextStyle(fontSize: 16.0)),
child: Theme(
data: Theme.of(context).copyWith(
colorScheme: ColorScheme.fromSeed(
primary: Theme.of(context).primaryColor,
seedColor: Theme.of(context).primaryColor,
brightness: isDarkThemeEnabled(context)
? Brightness.dark
: Brightness.light,
),
),
child: ValueListenableBuilder<bool>(
valueListenable: isSelected,
builder: (context, value, _) {
return InkWell(
child: InputDecorator(
isEmpty: time == null,
isFocused: value,
decoration: InputDecoration(
labelText: label,
icon: const Icon(Icons.access_time),
border: const OutlineInputBorder(),
),
child: Align(
alignment: Alignment.centerLeft,
child: SizedBox(
height: 18,
child: time == null
? Container()
: Text(time.toTimeOfDay().format(context),
style: TextStyle(fontSize: 16.0)),
),
),
),
),
onTap: () {
isSelected.value = true;
selectTime(context, initialTime: time).then((newTime) {
if (newTime != null) onChanged(newTime);
isSelected.value = false;
});
},
);
},
onTap: () {
isSelected.value = true;
selectTime(context, initialTime: time).then((newTime) {
if (newTime != null) onChanged(newTime);
isSelected.value = false;
});
},
);
},
),
),
);
}
Expand Down

0 comments on commit f755c18

Please sign in to comment.