Fixed Remaining Problems

This commit is contained in:
2024-03-15 21:09:16 +01:00
parent 3085a295e5
commit 421d19f91f
27 changed files with 120 additions and 112 deletions

View File

@ -6,11 +6,11 @@ class AppYesNoDialog extends StatelessWidget {
final void Function() onYesPressed;
const AppYesNoDialog({
Key key,
@required this.titleText,
@required this.contentText,
@required this.onYesPressed,
}) : super(key: key);
super.key,
required this.titleText,
required this.contentText,
required this.onYesPressed,
});
@override
Widget build(BuildContext context) {
@ -18,15 +18,15 @@ class AppYesNoDialog extends StatelessWidget {
title: Text(titleText),
content: Text(contentText),
actions: <Widget>[
FlatButton(
child: const Text("Yes"),
TextButton(
onPressed: onYesPressed,
child: const Text("Yes"),
),
FlatButton(
child: const Text("No"),
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("No"),
)
],
);

View File

@ -7,11 +7,12 @@ class ColorPickerButton extends StatelessWidget {
final Color selectedColor;
final void Function(Color) onColorPicked;
const ColorPickerButton({super.key,
@required this.title,
@required this.dialogTitle,
@required this.selectedColor,
@required this.onColorPicked,
const ColorPickerButton({
super.key,
required this.title,
required this.dialogTitle,
required this.selectedColor,
required this.onColorPicked,
});
@override
@ -35,9 +36,9 @@ class ColorPickerButton extends StatelessWidget {
);
},
style: TextButton.styleFrom(
primary: useBrightBackground(selectedColor)
? appTheme.primaryTextTheme.labelLarge.color
: appTheme.textTheme.labelLarge.color,
foregroundColor: useBrightBackground(selectedColor)
? appTheme.primaryTextTheme.labelLarge?.color
: appTheme.textTheme.labelLarge?.color,
backgroundColor: selectedColor,
),
child: Text(title),

View File

@ -3,12 +3,13 @@ import 'package:flutter/material.dart';
class DatePickerBtn extends StatelessWidget {
final String leadingString;
final DateTime pickedDate;
final void Function(DateTime) onDatePicked;
final void Function(DateTime?) onDatePicked;
const DatePickerBtn({super.key,
@required this.leadingString,
@required this.pickedDate,
@required this.onDatePicked,
const DatePickerBtn({
super.key,
required this.leadingString,
required this.pickedDate,
required this.onDatePicked,
});
void _onButtonPressed(BuildContext context) async {
@ -26,8 +27,8 @@ class DatePickerBtn extends StatelessWidget {
return TextButton(
onPressed: () => _onButtonPressed(context),
style: TextButton.styleFrom(
primary: appTheme.primaryTextTheme.labelLarge.color,
backgroundColor: appTheme.accentColor,
foregroundColor: appTheme.primaryTextTheme.labelLarge?.color,
backgroundColor: appTheme.colorScheme.secondary,
),
child: Text(
"$leadingString ${pickedDate.toLocal().toString().split(" ")[0]}"),

View File

@ -7,8 +7,8 @@ class SelectDurationBtn extends StatelessWidget {
const SelectDurationBtn({
super.key,
@required this.duration,
@required this.updateDuration,
required this.duration,
required this.updateDuration,
});
void _onPickerConfirm(Picker picker, List<int> values) {
@ -26,7 +26,7 @@ class SelectDurationBtn extends StatelessWidget {
]),
hideHeader: false,
title: const Text("Default Duration"),
selectedTextStyle: TextStyle(color: appTheme.accentColor),
selectedTextStyle: TextStyle(color: appTheme.colorScheme.secondary),
onConfirm: _onPickerConfirm)
.showModal(context);
@ -40,8 +40,8 @@ class SelectDurationBtn extends StatelessWidget {
return TextButton(
onPressed: () => _onButtonPressed(context, appTheme),
style: TextButton.styleFrom(
primary: appTheme.primaryTextTheme.labelLarge.color,
backgroundColor: appTheme.accentColor,
foregroundColor: appTheme.primaryTextTheme.labelLarge?.color,
backgroundColor: appTheme.colorScheme.secondary,
),
child: Text("$years Years $months Months $days Days"));
}

View File

@ -12,14 +12,14 @@ class DetailScreenFloatingActionButtons extends StatelessWidget {
const DetailScreenFloatingActionButtons({
super.key,
@required this.editMode,
@required this.originalProgress,
@required this.editedProgress,
@required this.isEditedProgressValid,
@required this.onEditProgress,
@required this.onSaveEditedProgress,
@required this.onCancelEditProgress,
@required this.onDeleteProgress,
required this.editMode,
required this.originalProgress,
required this.editedProgress,
required this.isEditedProgressValid,
required this.onEditProgress,
required this.onSaveEditedProgress,
required this.onCancelEditProgress,
required this.onDeleteProgress,
});
@override
@ -62,7 +62,7 @@ class DetailScreenFloatingActionButtons extends StatelessWidget {
child: FloatingActionButton(
heroTag:
editMode ? "saveEditedTimeProgressBTN" : "editTimeProgressBTN",
backgroundColor: editMode ? Colors.green : appTheme.accentColor,
backgroundColor: editMode ? Colors.green : appTheme.colorScheme.secondary,
onPressed: editMode
? isEditedProgressValid
? onSaveEditedProgress

View File

@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
class HomeBottomNavBar extends StatelessWidget {
final int currentIndex;
final Function onTap;
final void Function(int)? onTap;
const HomeBottomNavBar({
super.key,
@required this.currentIndex,
@required this.onTap,
required this.currentIndex,
required this.onTap,
});
@override

View File

@ -7,10 +7,10 @@ class ColorSettingsWidget extends StatelessWidget {
const ColorSettingsWidget({
super.key,
@required this.doneColor,
@required this.leftColor,
@required this.updateDoneColor,
@required this.updateLeftColor,
required this.doneColor,
required this.leftColor,
required this.updateDoneColor,
required this.updateLeftColor,
});
@override

View File

@ -7,8 +7,8 @@ class DurationSettingsWidget extends StatelessWidget {
const DurationSettingsWidget({
super.key,
@required this.duration,
@required this.updateDuration,
required this.duration,
required this.updateDuration,
});
@override

View File

@ -8,8 +8,8 @@ class ProgressEditorWidget extends StatefulWidget {
const ProgressEditorWidget({
super.key,
@required this.timeProgress,
@required this.onTimeProgressChanged,
required this.timeProgress,
required this.onTimeProgressChanged,
});
@override
@ -32,7 +32,10 @@ class _ProgressEditorWidgetState extends State<ProgressEditorWidget> {
});
}
void _onStartDateChanged(DateTime newStartDate) {
void _onStartDateChanged(DateTime? newStartDate) {
if (newStartDate == null) {
return;
}
TimeProgress newProgress =
widget.timeProgress.copyWith(startTime: newStartDate);
widget.onTimeProgressChanged(
@ -43,7 +46,10 @@ class _ProgressEditorWidgetState extends State<ProgressEditorWidget> {
});
}
void _onEndDateChanged(DateTime newEndDate) {
void _onEndDateChanged(DateTime? newEndDate) {
if (newEndDate == null) {
return;
}
TimeProgress newProgress =
widget.timeProgress.copyWith(endTime: newEndDate);
widget.onTimeProgressChanged(

View File

@ -19,9 +19,9 @@ class ProgressListTile extends StatelessWidget {
final Color doneColor, leftColor;
const ProgressListTile({super.key,
@required this.timeProgress,
@required this.doneColor,
@required this.leftColor,
required this.timeProgress,
required this.doneColor,
required this.leftColor,
});
Widget _renderSubtitle(BuildContext context) {

View File

@ -8,9 +8,9 @@ class ProgressListView extends StatelessWidget {
const ProgressListView({
super.key,
@required this.timeProgressList,
@required this.doneColor,
@required this.leftColor,
required this.timeProgressList,
required this.doneColor,
required this.leftColor,
});
List<Widget> _renderListViewChildren() {

View File

@ -10,9 +10,9 @@ class ProgressViewWidget extends StatelessWidget {
const ProgressViewWidget({
super.key,
@required this.timeProgress,
@required this.doneColor,
@required this.leftColor,
required this.timeProgress,
required this.doneColor,
required this.leftColor,
});
@override

View File

@ -10,7 +10,7 @@ class SettingsStoreConnector extends StatelessWidget {
const SettingsStoreConnector({
super.key,
@required this.loadedBuilder,
required this.loadedBuilder,
});
@override

View File

@ -10,7 +10,7 @@ class TimeProgressListStoreConnector extends StatelessWidget {
const TimeProgressListStoreConnector({
super.key,
@required this.loadedBuilder,
required this.loadedBuilder,
});
@override

View File

@ -13,8 +13,8 @@ class TimeProgressStoreConnector extends StatelessWidget {
const TimeProgressStoreConnector({
super.key,
@required this.timeProgressId,
@required this.loadedBuilder,
required this.timeProgressId,
required this.loadedBuilder,
});
@override
@ -29,11 +29,6 @@ class TimeProgressStoreConnector extends StatelessWidget {
child: CircularProgressIndicator(),
);
}
if (vm.tp == null) {
return const Center(
child: Text("Error Invalid Time Progress"),
);
}
return loadedBuilder(context, vm);
},
);