From 8015e476179695add9cc53c9041682d6fa2b484f Mon Sep 17 00:00:00 2001 From: Aliaksei Tratseuski Date: Mon, 5 Feb 2024 14:19:06 +0400 Subject: [PATCH] refactor: some ui dead code cleanup --- lib/config/md_files.dart | 1 - .../components/progress_bar/progress_bar.dart | 71 ------------------- lib/ui/pages/root_route.dart | 6 -- lib/ui/pages/server_details/text_details.dart | 2 - 4 files changed, 80 deletions(-) delete mode 100644 lib/config/md_files.dart diff --git a/lib/config/md_files.dart b/lib/config/md_files.dart deleted file mode 100644 index 8b137891..00000000 --- a/lib/config/md_files.dart +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/ui/components/progress_bar/progress_bar.dart b/lib/ui/components/progress_bar/progress_bar.dart index 1861bd0b..d1c00a24 100644 --- a/lib/ui/components/progress_bar/progress_bar.dart +++ b/lib/ui/components/progress_bar/progress_bar.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; class ProgressBar extends StatefulWidget { const ProgressBar({ @@ -21,41 +20,6 @@ class _ProgressBarState extends State { Widget build(final BuildContext context) { final double progress = 1 / widget.steps.length * (widget.activeIndex + 0.3); - final bool isDark = context.watch().state.isDarkModeOn; - final TextStyle style = - isDark ? progressTextStyleDark : progressTextStyleLight; - - final Iterable allSteps = widget.steps.asMap().map( - (final i, final step) { - final Container value = _stepTitle(index: i, style: style, step: step); - return MapEntry(i, value); - }, - ).values; - - final List odd = []; - final List even = []; - - int i = 0; - for (final Container step in allSteps) { - if (i.isEven) { - even.add(step); - } else { - odd.add(step); - } - i++; - } - - odd.insert( - 0, - const SizedBox( - width: 10, - ), - ); - odd.add( - const SizedBox( - width: 20, - ), - ); return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -91,39 +55,4 @@ class _ProgressBarState extends State { ], ); } - - Container _stepTitle({ - required final int index, - TextStyle? style, - final String? step, - }) { - final bool isActive = index == widget.activeIndex; - - style = isActive ? style!.copyWith(fontWeight: FontWeight.w700) : style; - return Container( - padding: const EdgeInsets.only(left: 10), - height: 20, - alignment: Alignment.center, - child: RichText( - textAlign: TextAlign.justify, - text: TextSpan( - style: progressTextStyleLight, - children: [ - TextSpan(text: '${index + 1}.', style: style), - TextSpan(text: step, style: style), - ], - ), - ), - ); - } } - -const TextStyle progressTextStyleLight = TextStyle( - fontSize: 11, - color: Colors.black, - height: 1.7, -); - -final TextStyle progressTextStyleDark = progressTextStyleLight.copyWith( - color: Colors.white, -); diff --git a/lib/ui/pages/root_route.dart b/lib/ui/pages/root_route.dart index b50f453b..6ae7607c 100644 --- a/lib/ui/pages/root_route.dart +++ b/lib/ui/pages/root_route.dart @@ -5,7 +5,6 @@ import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/ui/layouts/root_scaffold_with_navigation.dart'; import 'package:selfprivacy/ui/router/root_destinations.dart'; - import 'package:selfprivacy/ui/router/router.dart'; @RoutePage() @@ -150,8 +149,3 @@ class MainScreenNavigationDrawer extends StatelessWidget { ); } } - -class ChangeTab { - ChangeTab(this.onPress); - final ValueChanged onPress; -} diff --git a/lib/ui/pages/server_details/text_details.dart b/lib/ui/pages/server_details/text_details.dart index 2fef5440..f94a353b 100644 --- a/lib/ui/pages/server_details/text_details.dart +++ b/lib/ui/pages/server_details/text_details.dart @@ -56,5 +56,3 @@ class _TempMessage extends StatelessWidget { ), ); } - -final DateFormat formatter = DateFormat('HH:mm:ss');