Fix widget build conflict

This commit is contained in:
problematicconsumer
2024-02-12 18:39:51 +03:30
parent a771acbec6
commit eee31da912

View File

@@ -18,7 +18,6 @@ class ActiveProxyFooter extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final t = ref.watch(translationsProvider); final t = ref.watch(translationsProvider);
final asyncState = ref.watch(activeProxyNotifierProvider); final asyncState = ref.watch(activeProxyNotifierProvider);
final stats = ref.watch(statsNotifierProvider).value;
return AnimatedVisibility( return AnimatedVisibility(
axis: Axis.vertical, axis: Axis.vertical,
@@ -77,27 +76,7 @@ class ActiveProxyFooter extends HookConsumerWidget {
], ],
), ),
), ),
Directionality( const _StatsColumn(),
textDirection: TextDirection.values[
(Directionality.of(context).index + 1) %
TextDirection.values.length],
child: Flexible(
child: Column(
children: [
_InfoProp(
icon: FluentIcons
.arrow_bidirectional_up_down_20_regular,
text: (stats?.downlinkTotal ?? 0).size(),
),
const Gap(8),
_InfoProp(
icon: FluentIcons.arrow_download_20_regular,
text: (stats?.downlink ?? 0).speed(),
),
],
),
),
),
], ],
), ),
), ),
@@ -107,6 +86,35 @@ class ActiveProxyFooter extends HookConsumerWidget {
} }
} }
class _StatsColumn extends HookConsumerWidget {
const _StatsColumn();
@override
Widget build(BuildContext context, WidgetRef ref) {
final stats = ref.watch(statsNotifierProvider).value;
return Directionality(
textDirection: TextDirection.values[
(Directionality.of(context).index + 1) % TextDirection.values.length],
child: Flexible(
child: Column(
children: [
_InfoProp(
icon: FluentIcons.arrow_bidirectional_up_down_20_regular,
text: (stats?.downlinkTotal ?? 0).size(),
),
const Gap(8),
_InfoProp(
icon: FluentIcons.arrow_download_20_regular,
text: (stats?.downlink ?? 0).speed(),
),
],
),
),
);
}
}
class _InfoProp extends StatelessWidget { class _InfoProp extends StatelessWidget {
const _InfoProp({ const _InfoProp({
required this.icon, required this.icon,