refactor: some ui dead code cleanup

pull/444/head
Aliaksei Tratseuski 2024-02-05 14:19:06 +04:00 committed by aliaksei tratseuski
parent b750d603b5
commit 8015e47617
4 changed files with 0 additions and 80 deletions

View File

@ -1 +0,0 @@

View File

@ -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<ProgressBar> {
Widget build(final BuildContext context) {
final double progress =
1 / widget.steps.length * (widget.activeIndex + 0.3);
final bool isDark = context.watch<AppSettingsCubit>().state.isDarkModeOn;
final TextStyle style =
isDark ? progressTextStyleDark : progressTextStyleLight;
final Iterable<Container> 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<Widget> odd = [];
final List<Widget> 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<ProgressBar> {
],
);
}
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,
);

View File

@ -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<int> onPress;
}

View File

@ -56,5 +56,3 @@ class _TempMessage extends StatelessWidget {
),
);
}
final DateFormat formatter = DateFormat('HH:mm:ss');