* Implemented hasSettingsLoaded reducer * Added Padding to Progress List View * Created Settings and Time Progress List Store Connector * Rewritten Home Active Tab * Fixed missing onTap in Progress List Tile * Started using new Store Connectors in Inactive and Settings Tab * Created Time Progress Store Connector * Rewritten ProgressDetailScreen with new Store Connectors * Rewritten DatePickerBtn with TextButton * Deleted unused widget * Changed Foreground Color behaviour in ColorPicker BTN * Created Select Duration Button * Rewritten Duration Setting Widget * Updated Version Number Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
37 lines
978 B
Dart
37 lines
978 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class DatePickerBtn extends StatelessWidget {
|
|
final String leadingString;
|
|
final DateTime pickedDate;
|
|
final void Function(DateTime) onDatePicked;
|
|
|
|
DatePickerBtn({
|
|
@required this.leadingString,
|
|
@required this.pickedDate,
|
|
@required this.onDatePicked,
|
|
}) : super();
|
|
|
|
void _onButtonPressed(BuildContext context) async {
|
|
onDatePicked(await showDatePicker(
|
|
context: context,
|
|
initialDate: pickedDate,
|
|
firstDate: DateTime(1900),
|
|
lastDate: DateTime(2100),
|
|
));
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ThemeData appTheme = Theme.of(context);
|
|
return TextButton(
|
|
onPressed: () => _onButtonPressed(context),
|
|
child: Text(
|
|
"$leadingString ${pickedDate.toLocal().toString().split(" ")[0]}"),
|
|
style: TextButton.styleFrom(
|
|
primary: appTheme.primaryTextTheme.button.color,
|
|
backgroundColor: appTheme.accentColor,
|
|
),
|
|
);
|
|
}
|
|
}
|