claude refactor
This commit is contained in:
@@ -3,18 +3,19 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../model/accountData.dart';
|
||||
import '../../model/timetable/timetableProps.dart';
|
||||
import '../../notification/notifyUpdater.dart';
|
||||
import '../../storage/base/settingsProvider.dart';
|
||||
import '../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../state/app/modules/timetable/bloc/timetable_bloc.dart';
|
||||
import '../../storage/base/settings.dart' as model;
|
||||
import '../../theming/appTheme.dart';
|
||||
import '../../widget/centeredLeading.dart';
|
||||
import '../../widget/confirmDialog.dart';
|
||||
import '../../widget/debug/cacheView.dart';
|
||||
import '../pages/timetable/timetableNameMode.dart';
|
||||
import '../../storage/timetable/timetable_name_mode.dart';
|
||||
import 'defaultSettings.dart';
|
||||
import 'devToolsSettings.dart';
|
||||
import 'privacyInfo.dart';
|
||||
@@ -36,7 +37,9 @@ class _SettingsState extends State<Settings> {
|
||||
bool developerMode = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Consumer<SettingsProvider>(builder: (context, settings, child) => Scaffold(
|
||||
Widget build(BuildContext context) => BlocBuilder<SettingsCubit, model.Settings>(builder: (context, _) {
|
||||
final settings = context.read<SettingsCubit>();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Einstellungen'),
|
||||
),
|
||||
@@ -58,7 +61,8 @@ class _SettingsState extends State<Settings> {
|
||||
value.clear(),
|
||||
}).then((value) async {
|
||||
PaintingBinding.instance.imageCache.clear();
|
||||
Provider.of<SettingsProvider>(context, listen: false).reset();
|
||||
if (!context.mounted) return;
|
||||
context.read<SettingsCubit>().reset();
|
||||
const CacheView().clear();
|
||||
AccountData().removeData(context: context);
|
||||
Navigator.popUntil(context, (route) => !Navigator.canPop(context));
|
||||
@@ -115,7 +119,7 @@ class _SettingsState extends State<Settings> {
|
||||
)).toList(),
|
||||
onChanged: (value) {
|
||||
settings.val(write: true).timetableSettings.timetableNameMode = value!;
|
||||
Provider.of<TimetableProps>(context, listen: false).run(renew: false);
|
||||
context.read<TimetableBloc>().refresh();
|
||||
},
|
||||
)
|
||||
),
|
||||
@@ -126,7 +130,7 @@ class _SettingsState extends State<Settings> {
|
||||
value: settings.val().timetableSettings.connectDoubleLessons,
|
||||
onChanged: (e) {
|
||||
settings.val(write: true).timetableSettings.connectDoubleLessons = e!;
|
||||
Provider.of<TimetableProps>(context, listen: false).run(renew: false);
|
||||
context.read<TimetableBloc>().refresh();
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -215,6 +219,7 @@ class _SettingsState extends State<Settings> {
|
||||
title: const Text('Informationen und Lizenzen'),
|
||||
onTap: () {
|
||||
PackageInfo.fromPlatform().then((appInfo) {
|
||||
if (!context.mounted) return;
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
applicationIcon: const Icon(Icons.apps),
|
||||
@@ -308,5 +313,6 @@ class _SettingsState extends State<Settings> {
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user