Fix ui bugs
This commit is contained in:
@@ -6,7 +6,8 @@ import 'package:hiddify/features/common/adaptive_root_scaffold.dart';
|
||||
bool showDrawerButton(BuildContext context) {
|
||||
if (!useMobileRouter) return true;
|
||||
final String location = GoRouterState.of(context).uri.path;
|
||||
if (location == const HomeRoute().location) return true;
|
||||
if (location == const HomeRoute().location ||
|
||||
location == const ProfilesRoute().location) return true;
|
||||
if (location.startsWith(const ProxiesRoute().location)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -345,21 +345,27 @@ class ProfileSubscriptionInfo extends HookConsumerWidget {
|
||||
children: [
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Text(
|
||||
subInfo.total > 10 * 1099511627776 //10TB
|
||||
? "∞ GiB"
|
||||
: subInfo.consumption.sizeOf(subInfo.total),
|
||||
semanticsLabel:
|
||||
t.profile.subscription.remainingTrafficSemanticLabel(
|
||||
consumed: subInfo.consumption.sizeGB(),
|
||||
total: subInfo.total.sizeGB(),
|
||||
child: Flexible(
|
||||
child: Text(
|
||||
subInfo.total > 10 * 1099511627776 //10TB
|
||||
? "∞ GiB"
|
||||
: subInfo.consumption.sizeOf(subInfo.total),
|
||||
semanticsLabel:
|
||||
t.profile.subscription.remainingTrafficSemanticLabel(
|
||||
consumed: subInfo.consumption.sizeGB(),
|
||||
total: subInfo.total.sizeGB(),
|
||||
),
|
||||
style: theme.textTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
remaining.$1,
|
||||
style: theme.textTheme.bodySmall?.copyWith(color: remaining.$2),
|
||||
Flexible(
|
||||
child: Text(
|
||||
remaining.$1,
|
||||
style: theme.textTheme.bodySmall?.copyWith(color: remaining.$2),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:dartx/dartx.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hiddify/core/core_providers.dart';
|
||||
import 'package:hiddify/core/router/router.dart';
|
||||
import 'package:hiddify/domain/failures.dart';
|
||||
@@ -30,12 +29,17 @@ class HomePage extends HookConsumerWidget {
|
||||
CustomScrollView(
|
||||
slivers: [
|
||||
NestedAppBar(
|
||||
title: Row(
|
||||
children: [
|
||||
Text(t.general.appTitle),
|
||||
const Gap(4),
|
||||
const AppVersionLabel(),
|
||||
],
|
||||
title: Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(text: t.general.appTitle),
|
||||
const TextSpan(text: " "),
|
||||
const WidgetSpan(
|
||||
child: AppVersionLabel(),
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
|
||||
@@ -21,86 +21,87 @@ class IntroPage extends HookConsumerWidget with PresLogger {
|
||||
|
||||
final isStarting = useState(false);
|
||||
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
shrinkWrap: true,
|
||||
slivers: [
|
||||
const SliverGap(24),
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
width: 248,
|
||||
height: 248,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(36),
|
||||
child: Assets.images.logo.svg(),
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
body: CustomScrollView(
|
||||
shrinkWrap: true,
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
width: 224,
|
||||
height: 224,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Assets.images.logo.svg(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverCrossAxisConstrained(
|
||||
maxCrossAxisExtent: 368,
|
||||
child: MultiSliver(
|
||||
children: [
|
||||
const LocalePrefTile(),
|
||||
const SliverGap(8),
|
||||
const RegionPrefTile(),
|
||||
const SliverGap(8),
|
||||
const EnableAnalyticsPrefTile(),
|
||||
const SliverGap(8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text.rich(
|
||||
t.intro.termsAndPolicyCaution(
|
||||
tap: (text) => TextSpan(
|
||||
text: text,
|
||||
style: const TextStyle(color: Colors.blue),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () async {
|
||||
await UriUtils.tryLaunch(
|
||||
Uri.parse(Constants.termsAndConditionsUrl),
|
||||
);
|
||||
},
|
||||
SliverCrossAxisConstrained(
|
||||
maxCrossAxisExtent: 368,
|
||||
child: MultiSliver(
|
||||
children: [
|
||||
const LocalePrefTile(),
|
||||
const SliverGap(4),
|
||||
const RegionPrefTile(),
|
||||
const SliverGap(4),
|
||||
const EnableAnalyticsPrefTile(),
|
||||
const SliverGap(4),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text.rich(
|
||||
t.intro.termsAndPolicyCaution(
|
||||
tap: (text) => TextSpan(
|
||||
text: text,
|
||||
style: const TextStyle(color: Colors.blue),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () async {
|
||||
await UriUtils.tryLaunch(
|
||||
Uri.parse(Constants.termsAndConditionsUrl),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 24,
|
||||
),
|
||||
child: FilledButton(
|
||||
onPressed: () async {
|
||||
if (isStarting.value) return;
|
||||
isStarting.value = true;
|
||||
if (!ref.read(enableAnalyticsProvider)) {
|
||||
loggy.info("disabling analytics per user request");
|
||||
try {
|
||||
await Sentry.close();
|
||||
} catch (error, stackTrace) {
|
||||
loggy.error(
|
||||
"could not disable analytics",
|
||||
error,
|
||||
stackTrace,
|
||||
);
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 24,
|
||||
),
|
||||
child: FilledButton(
|
||||
onPressed: () async {
|
||||
if (isStarting.value) return;
|
||||
isStarting.value = true;
|
||||
if (!ref.read(enableAnalyticsProvider)) {
|
||||
loggy.info("disabling analytics per user request");
|
||||
try {
|
||||
await Sentry.close();
|
||||
} catch (error, stackTrace) {
|
||||
loggy.error(
|
||||
"could not disable analytics",
|
||||
error,
|
||||
stackTrace,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
await ref
|
||||
.read(introCompletedProvider.notifier)
|
||||
.update(true);
|
||||
},
|
||||
child: isStarting.value
|
||||
? LinearProgressIndicator(
|
||||
backgroundColor: Colors.transparent,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
)
|
||||
: Text(t.intro.start),
|
||||
await ref
|
||||
.read(introCompletedProvider.notifier)
|
||||
.update(true);
|
||||
},
|
||||
child: isStarting.value
|
||||
? LinearProgressIndicator(
|
||||
backgroundColor: Colors.transparent,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
)
|
||||
: Text(t.intro.start),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class BottomSheetPage extends Page {
|
||||
Route<void> createRoute(BuildContext context) {
|
||||
return ModalBottomSheetRoute(
|
||||
settings: this,
|
||||
isScrollControlled: !fixed,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
showDragHandle: true,
|
||||
builder: (_) {
|
||||
|
||||
Reference in New Issue
Block a user