mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 05:03:44 +02:00
fix: don't use initState when the variable can be instatiated through the class definition instead
This commit is contained in:
parent
f5962acf7a
commit
1d65ac5096
1 changed files with 10 additions and 18 deletions
|
@ -49,18 +49,7 @@ class AvailabilitiesModificationScreen extends StatefulWidget {
|
|||
|
||||
class _AvailabilitiesModificationScreenState
|
||||
extends State<AvailabilitiesModificationScreen> {
|
||||
late AvailabilityModel _availability;
|
||||
late List<AvailabilityTemplateModel> _selectedTemplates;
|
||||
bool _clearAvailability = false;
|
||||
TimeOfDay? _startTime;
|
||||
TimeOfDay? _endTime;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// TODO(Joey): These can be immediately assigned to the properties
|
||||
// This removes the need for an initState
|
||||
_availability =
|
||||
late AvailabilityModel _availability =
|
||||
widget.initialAvailabilities.getAvailabilities().firstOrNull ??
|
||||
AvailabilityModel(
|
||||
userId: "",
|
||||
|
@ -68,8 +57,11 @@ class _AvailabilitiesModificationScreenState
|
|||
endDate: widget.dateRange.end,
|
||||
breaks: [],
|
||||
);
|
||||
_selectedTemplates = widget.initialAvailabilities.getUniqueTemplates();
|
||||
}
|
||||
late List<AvailabilityTemplateModel> _selectedTemplates =
|
||||
widget.initialAvailabilities.getUniqueTemplates();
|
||||
bool _clearAvailability = false;
|
||||
TimeOfDay? _startTime;
|
||||
TimeOfDay? _endTime;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
Loading…
Reference in a new issue