Fixed Simple Problem, that occured after migrating to new version.
Still WIP need to fix more Problems
This commit is contained in:
@ -9,6 +9,8 @@ class HomeScreen extends StatefulWidget {
|
||||
static const routeName = "/home";
|
||||
static const title = "Time Progress Tracker";
|
||||
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _HomeScreenState();
|
||||
@ -18,9 +20,9 @@ class HomeScreen extends StatefulWidget {
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
int _currentIndex = 0;
|
||||
final List<Widget> _children = [
|
||||
HomeActiveProgressesTab(),
|
||||
HomeInactiveProgressesTab(),
|
||||
HomeSettingsTab(),
|
||||
const HomeActiveProgressesTab(),
|
||||
const HomeInactiveProgressesTab(),
|
||||
const HomeSettingsTab(),
|
||||
];
|
||||
|
||||
void onBottomTabTapped(int index) {
|
||||
@ -33,11 +35,11 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(HomeScreen.title),
|
||||
title: const Text(HomeScreen.title),
|
||||
),
|
||||
body: _children[_currentIndex],
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||
floatingActionButton: _currentIndex != 2 ? CreateProgressButton() : null,
|
||||
floatingActionButton: _currentIndex != 2 ? const CreateProgressButton() : null,
|
||||
bottomNavigationBar: HomeBottomNavBar(
|
||||
currentIndex: _currentIndex,
|
||||
onTap: onBottomTabTapped,
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
@ -13,6 +12,8 @@ class ProgressCreationScreen extends StatefulWidget {
|
||||
static const routeName = "/create-progress";
|
||||
static const title = "Create Time Progress";
|
||||
|
||||
const ProgressCreationScreen({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ProgressCreationScreenState();
|
||||
@ -20,14 +21,15 @@ class ProgressCreationScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProgressCreationScreenState extends State<ProgressCreationScreen> {
|
||||
TimeProgress timeProgressToCreate;
|
||||
TimeProgress? timeProgressToCreate;
|
||||
bool _isProgressValid = false;
|
||||
|
||||
void initTimeProgress(TimeProgress timeProgress) {
|
||||
if (timeProgressToCreate == null)
|
||||
if (timeProgressToCreate == null) {
|
||||
setState(() {
|
||||
timeProgressToCreate = timeProgress;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void onTimeProgressChanged(
|
||||
@ -42,10 +44,10 @@ class _ProgressCreationScreenState extends State<ProgressCreationScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(ProgressCreationScreen.title),
|
||||
title: const Text(ProgressCreationScreen.title),
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: StoreConnector<AppState, _ViewModel>(
|
||||
onInit: loadSettingsIfUnloaded,
|
||||
converter: (store) => _ViewModel.create(store),
|
||||
@ -66,23 +68,23 @@ class _ProgressCreationScreenState extends State<ProgressCreationScreen> {
|
||||
converter: (store) => _ViewModel.create(store),
|
||||
builder: (context, _ViewModel vm) => FloatingActionButton(
|
||||
heroTag: "createTimeProgressBTN",
|
||||
child: Icon(Icons.save),
|
||||
onPressed: _isProgressValid
|
||||
? () {
|
||||
vm.onAddTimeProgress(timeProgressToCreate);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
: null,
|
||||
child: const Icon(Icons.save),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag: "cancelTimeProgressCreationBTN",
|
||||
child: Icon(Icons.cancel),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Icon(Icons.cancel),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -103,14 +105,14 @@ class _ViewModel {
|
||||
factory _ViewModel.create(Store<AppState> store) {
|
||||
AppSettings settings = appSettingsSelector(store.state);
|
||||
|
||||
_onAddTimeProgress(TimeProgress tp) {
|
||||
onAddTimeProgress(TimeProgress tp) {
|
||||
if (TimeProgress.isValid(tp)) store.dispatch(AddTimeProgressAction(tp));
|
||||
}
|
||||
|
||||
return _ViewModel(
|
||||
defaultDurationProgress:
|
||||
TimeProgress.defaultFromDuration(settings.duration),
|
||||
onAddTimeProgress: _onAddTimeProgress,
|
||||
onAddTimeProgress: onAddTimeProgress,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ class ProgressDetailScreen extends StatefulWidget {
|
||||
static const routeName = "/progress";
|
||||
static const title = "Progress View";
|
||||
|
||||
const ProgressDetailScreen({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ProgressDetailScreenState();
|
||||
@ -25,7 +27,7 @@ class ProgressDetailScreen extends StatefulWidget {
|
||||
|
||||
class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
|
||||
bool _editMode = false, _isEditedProgressValid = false;
|
||||
TimeProgress _editedProgress, _originalProgress;
|
||||
TimeProgress? _editedProgress, _originalProgress;
|
||||
|
||||
void _initEditedProgress(TimeProgress tp) {
|
||||
if (_editedProgress == null) {
|
||||
@ -65,12 +67,13 @@ class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
|
||||
leftColor: settingsVm.appSettings.leftColor,
|
||||
))
|
||||
];
|
||||
if (_editMode)
|
||||
if (_editMode) {
|
||||
columnChildren.add(Expanded(
|
||||
child: ProgressEditorWidget(
|
||||
timeProgress: _editedProgress,
|
||||
onTimeProgressChanged: _onEditedProgressChanged,
|
||||
)));
|
||||
}
|
||||
return columnChildren;
|
||||
}
|
||||
|
||||
@ -81,7 +84,7 @@ class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(ProgressDetailScreen.title),
|
||||
title: const Text(ProgressDetailScreen.title),
|
||||
),
|
||||
body: SettingsStoreConnector(
|
||||
loadedBuilder: (context, settingsVm) {
|
||||
@ -90,7 +93,7 @@ class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
|
||||
loadedBuilder: (context, tpVm) {
|
||||
_initEditedProgress(tpVm.tp);
|
||||
return Container(
|
||||
margin: EdgeInsets.all(8),
|
||||
margin: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
children: _renderColumnChildren(settingsVm, tpVm),
|
||||
));
|
||||
@ -102,12 +105,12 @@ class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
|
||||
floatingActionButton: TimeProgressStoreConnector(
|
||||
timeProgressId: args.id,
|
||||
loadedBuilder: (context, tpVm) {
|
||||
void _saveEditedProgress() {
|
||||
void saveEditedProgress() {
|
||||
tpVm.updateTimeProgress(_editedProgress);
|
||||
_switchEditMode(false);
|
||||
}
|
||||
|
||||
void _deleteTimeProgress() {
|
||||
void deleteTimeProgress() {
|
||||
tpVm.deleteTimeProgress();
|
||||
Navigator.popUntil(
|
||||
context, ModalRoute.withName(HomeScreen.routeName));
|
||||
@ -119,9 +122,9 @@ class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
|
||||
editedProgress: _editedProgress,
|
||||
isEditedProgressValid: _isEditedProgressValid,
|
||||
onEditProgress: () => _switchEditMode(true),
|
||||
onSaveEditedProgress: _saveEditedProgress,
|
||||
onSaveEditedProgress: saveEditedProgress,
|
||||
onCancelEditProgress: _cancelEditMode,
|
||||
onDeleteProgress: _deleteTimeProgress);
|
||||
onDeleteProgress: deleteTimeProgress);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user