Feature/change progress colors (#6)

* Added Settings Actions
* Created App Settings and Repo + Entity
* Code cleanup Time Progress
* Created App Settings Middleware
* Has Progresses ad has Settings loaded
* Created Load and Update Settings reducers
* Added Settings store middleware to renamed store middleware
* Load Default Settings if not Saved. Use Redux AppState to showprogress colors.
Colors are not yet changeable.
* Added ColorPicker for Done and Left Color
Fixed Loading App Settings Bug
* Fixed Version Number
* Fixed Android App Logo
* Extracted Color Settings into Widget
* Fixed Home Settings Tab Layout and Color Settings Button now show Text in complementary color
This commit is contained in:
Andreas Fahrecker
2021-03-03 16:35:08 +01:00
committed by GitHub
parent c580e45361
commit b520d56d1a
23 changed files with 545 additions and 150 deletions

View File

@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
class ColorPickerButton extends StatelessWidget {
final String title, dialogTitle;
final Color selectedColor;
final void Function(Color) onColorPicked;
ColorPickerButton({
@required this.title,
@required this.dialogTitle,
@required this.selectedColor,
@required this.onColorPicked,
});
@override
Widget build(BuildContext context) {
Color getBtnPrimaryColor() => Color.fromARGB(
selectedColor.alpha,
selectedColor.alpha - selectedColor.red,
selectedColor.alpha - selectedColor.green,
selectedColor.alpha - selectedColor.blue,
);
return TextButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(dialogTitle),
content: SingleChildScrollView(
child: BlockPicker(
pickerColor: selectedColor,
onColorChanged: onColorPicked,
),
),
);
},
);
},
child: Text(title),
style: TextButton.styleFrom(
primary: getBtnPrimaryColor(),
backgroundColor: selectedColor,
),
);
}
}

View File

@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:time_progress_tracker/widgets/home/tabs/settings/color_picker_btn.dart';
class ColorSettingsWidget extends StatelessWidget {
final Color doneColor, leftColor;
final void Function(Color) updateDoneColor, updateLeftColor;
ColorSettingsWidget({
@required this.doneColor,
@required this.leftColor,
@required this.updateDoneColor,
@required this.updateLeftColor,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
Expanded(
child: Text(
"Color Settings",
style:
TextStyle(fontWeight: FontWeight.bold, color: Colors.black87),
),
),
Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.only(right: 5),
child: ColorPickerButton(
title: "Done Color",
dialogTitle: "Select Done Color",
selectedColor: doneColor,
onColorPicked: updateDoneColor,
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 5),
child: ColorPickerButton(
title: "Left Color",
dialogTitle: "Select Left Color",
selectedColor: leftColor,
onColorPicked: updateLeftColor,
),
),
),
],
)
],
);
}
}

View File

@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
class DirectSelectItem extends StatelessWidget {
final String title;
final bool isForList;
DirectSelectItem({this.title, this.isForList});
@override
Widget build(BuildContext context) {
return SizedBox(
height: 60,
child: isForList
? Padding(
child: _buildItem(context),
padding: EdgeInsets.all(10),
)
: Card(
margin: EdgeInsets.symmetric(horizontal: 10),
child: Stack(
children: [
_buildItem(context),
Align(
alignment: Alignment.centerRight,
child: Icon(Icons.arrow_drop_down),
)
],
),
));
}
Container _buildItem(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
child: Text(title),
);
}
}