Skip to content

Commit 14acefb

Browse files
committed
fix
1 parent 4672e5d commit 14acefb

4 files changed

Lines changed: 121 additions & 76 deletions

File tree

lib/pages/servers/subscription_import_page.dart

Lines changed: 103 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class SubscriptionImportPage extends StatefulWidget {
1717
}
1818

1919
enum _Method { url, qr, file }
20+
2021
enum _ImportState { idle, fetching, success, error }
2122

2223
class _SubscriptionImportPageState extends State<SubscriptionImportPage> {
@@ -45,10 +46,10 @@ class _SubscriptionImportPageState extends State<SubscriptionImportPage> {
4546
setState(() => _state = _ImportState.fetching);
4647
try {
4748
final n = await context.read<SubscriptionProvider>().importFromUrl(
48-
url: _urlCtrl.text.trim(),
49-
name: _nameCtrl.text.trim().isEmpty ? null : _nameCtrl.text.trim(),
50-
autoUpdate: _autoUpdate,
51-
);
49+
url: _urlCtrl.text.trim(),
50+
name: _nameCtrl.text.trim().isEmpty ? null : _nameCtrl.text.trim(),
51+
autoUpdate: _autoUpdate,
52+
);
5253
if (!mounted) return;
5354
setState(() {
5455
_state = _ImportState.success;
@@ -69,8 +70,8 @@ class _SubscriptionImportPageState extends State<SubscriptionImportPage> {
6970
final l = AppLocalizations.of(context)!;
7071
final theme = Theme.of(context);
7172
final media = MediaQuery.of(context);
72-
final canImport = _urlCtrl.text.trim().isNotEmpty &&
73-
_state != _ImportState.fetching;
73+
final canImport =
74+
_urlCtrl.text.trim().isNotEmpty && _state != _ImportState.fetching;
7475

7576
return Padding(
7677
padding: EdgeInsets.only(bottom: media.viewInsets.bottom),
@@ -79,14 +80,16 @@ class _SubscriptionImportPageState extends State<SubscriptionImportPage> {
7980
decoration: BoxDecoration(
8081
color: theme.scaffoldBackgroundColor,
8182
borderRadius: const BorderRadius.vertical(
82-
top: Radius.circular(AppSpacing.radiusLg)),
83+
top: Radius.circular(AppSpacing.radiusLg),
84+
),
8385
),
8486
child: Column(
8587
mainAxisSize: MainAxisSize.min,
8688
children: [
8789
const SizedBox(height: AppSpacing.sm),
8890
Container(
89-
width: 40, height: 4,
91+
width: 40,
92+
height: 4,
9093
decoration: BoxDecoration(
9194
color: AppColors.textMuted.withValues(alpha: 0.3),
9295
borderRadius: BorderRadius.circular(2),
@@ -95,7 +98,8 @@ class _SubscriptionImportPageState extends State<SubscriptionImportPage> {
9598
const SizedBox(height: AppSpacing.md),
9699
Padding(
97100
padding: const EdgeInsets.symmetric(
98-
horizontal: AppSpacing.pageGutter),
101+
horizontal: AppSpacing.pageGutter,
102+
),
99103
child: Row(
100104
children: [
101105
IconButton(
@@ -132,32 +136,38 @@ class _SubscriptionImportPageState extends State<SubscriptionImportPage> {
132136
onChanged: (_) => setState(() {}),
133137
),
134138
const SizedBox(height: AppSpacing.sm),
135-
Row(children: [
136-
_Chip(
137-
icon: Icons.content_paste_rounded,
138-
label: l.paste,
139-
onTap: () async { await _paste(); setState(() {}); },
140-
),
141-
const SizedBox(width: AppSpacing.xs),
142-
_Chip(
143-
icon: Icons.qr_code_scanner_rounded,
144-
label: l.scan_qr,
145-
onTap: () {
146-
// TODO: open camera scanner; on success, set _urlCtrl.
147-
},
148-
),
149-
]),
139+
Row(
140+
children: [
141+
_Chip(
142+
icon: Icons.content_paste_rounded,
143+
label: l.paste,
144+
onTap: () async {
145+
await _paste();
146+
setState(() {});
147+
},
148+
),
149+
const SizedBox(width: AppSpacing.xs),
150+
_Chip(
151+
icon: Icons.qr_code_scanner_rounded,
152+
label: l.scan_qr,
153+
onTap: () {
154+
// TODO: open camera scanner; on success, set _urlCtrl.
155+
},
156+
),
157+
],
158+
),
150159
const SizedBox(height: AppSpacing.lg),
151160
_FieldLabel(text: l.display_name_optional),
152161
TextField(
153162
controller: _nameCtrl,
154163
decoration: InputDecoration(
155-
hintText: 'Hiddify · Public',
164+
hintText: 'Subscription #1',
156165
filled: true,
157166
fillColor: theme.colorScheme.surface,
158167
border: OutlineInputBorder(
159-
borderRadius:
160-
BorderRadius.circular(AppSpacing.radiusMd),
168+
borderRadius: BorderRadius.circular(
169+
AppSpacing.radiusMd,
170+
),
161171
borderSide: BorderSide.none,
162172
),
163173
),
@@ -197,8 +207,9 @@ class _SubscriptionImportPageState extends State<SubscriptionImportPage> {
197207
padding: EdgeInsets.only(bottom: AppSpacing.sm),
198208
child: LinearProgressIndicator(
199209
backgroundColor: Color(0x2900C6FB),
200-
valueColor:
201-
AlwaysStoppedAnimation<Color>(AppColors.brandBlue),
210+
valueColor: AlwaysStoppedAnimation<Color>(
211+
AppColors.brandBlue,
212+
),
202213
),
203214
),
204215
SizedBox(
@@ -208,24 +219,28 @@ class _SubscriptionImportPageState extends State<SubscriptionImportPage> {
208219
decoration: BoxDecoration(
209220
gradient: canImport ? AppColors.brandGradient : null,
210221
color: canImport ? null : const Color(0xFFC8D4DC),
211-
borderRadius:
212-
BorderRadius.circular(AppSpacing.radiusMd),
213-
boxShadow: canImport
214-
? [
215-
BoxShadow(
216-
color: AppColors.brandBlue
217-
.withValues(alpha: 0.3),
218-
blurRadius: 16,
219-
offset: const Offset(0, 6),
220-
),
221-
]
222-
: null,
222+
borderRadius: BorderRadius.circular(
223+
AppSpacing.radiusMd,
224+
),
225+
boxShadow:
226+
canImport
227+
? [
228+
BoxShadow(
229+
color: AppColors.brandBlue.withValues(
230+
alpha: 0.3,
231+
),
232+
blurRadius: 16,
233+
offset: const Offset(0, 6),
234+
),
235+
]
236+
: null,
223237
),
224238
child: Material(
225239
color: Colors.transparent,
226240
child: InkWell(
227-
borderRadius:
228-
BorderRadius.circular(AppSpacing.radiusMd),
241+
borderRadius: BorderRadius.circular(
242+
AppSpacing.radiusMd,
243+
),
229244
onTap: canImport ? _doImport : null,
230245
child: Center(
231246
child: Text(
@@ -290,9 +305,8 @@ class _MethodSegment extends StatelessWidget {
290305
child: Text(
291306
it.$2,
292307
style: theme.textTheme.bodyMedium?.copyWith(
293-
color: method == it.$1
294-
? Colors.white
295-
: AppColors.textMuted,
308+
color:
309+
method == it.$1 ? Colors.white : AppColors.textMuted,
296310
fontWeight: FontWeight.w500,
297311
),
298312
),
@@ -315,7 +329,9 @@ class _UrlField extends StatelessWidget {
315329
final l = AppLocalizations.of(context)!;
316330
return Container(
317331
padding: const EdgeInsets.symmetric(
318-
horizontal: AppSpacing.md, vertical: AppSpacing.sm),
332+
horizontal: AppSpacing.md,
333+
vertical: AppSpacing.sm,
334+
),
319335
decoration: BoxDecoration(
320336
color: theme.colorScheme.surface,
321337
borderRadius: BorderRadius.circular(AppSpacing.radiusMd),
@@ -353,14 +369,22 @@ class _Chip extends StatelessWidget {
353369
onTap: onTap,
354370
child: Padding(
355371
padding: const EdgeInsets.symmetric(
356-
horizontal: AppSpacing.sm, vertical: 6),
357-
child: Row(mainAxisSize: MainAxisSize.min, children: [
358-
Icon(icon, size: 16, color: theme.colorScheme.primary),
359-
const SizedBox(width: 6),
360-
Text(label,
361-
style: theme.textTheme.bodySmall
362-
?.copyWith(color: theme.colorScheme.primary)),
363-
]),
372+
horizontal: AppSpacing.sm,
373+
vertical: 6,
374+
),
375+
child: Row(
376+
mainAxisSize: MainAxisSize.min,
377+
children: [
378+
Icon(icon, size: 16, color: theme.colorScheme.primary),
379+
const SizedBox(width: 6),
380+
Text(
381+
label,
382+
style: theme.textTheme.bodySmall?.copyWith(
383+
color: theme.colorScheme.primary,
384+
),
385+
),
386+
],
387+
),
364388
),
365389
),
366390
);
@@ -374,11 +398,12 @@ class _FieldLabel extends StatelessWidget {
374398
Widget build(BuildContext context) {
375399
return Padding(
376400
padding: const EdgeInsets.only(left: 4, bottom: 6),
377-
child: Text(text,
378-
style: Theme.of(context)
379-
.textTheme
380-
.bodySmall
381-
?.copyWith(color: AppColors.textMuted)),
401+
child: Text(
402+
text,
403+
style: Theme.of(
404+
context,
405+
).textTheme.bodySmall?.copyWith(color: AppColors.textMuted),
406+
),
382407
);
383408
}
384409
}
@@ -399,9 +424,12 @@ class _AutoUpdateRow extends StatelessWidget {
399424
children: [
400425
Text(l.auto_update, style: theme.textTheme.titleMedium),
401426
const SizedBox(height: 2),
402-
Text(l.auto_update_hint,
403-
style: theme.textTheme.bodySmall
404-
?.copyWith(color: AppColors.textMuted)),
427+
Text(
428+
l.auto_update_hint,
429+
style: theme.textTheme.bodySmall?.copyWith(
430+
color: AppColors.textMuted,
431+
),
432+
),
405433
],
406434
),
407435
),
@@ -420,17 +448,22 @@ class _Toast extends StatelessWidget {
420448
Widget build(BuildContext context) {
421449
return Container(
422450
padding: const EdgeInsets.symmetric(
423-
horizontal: AppSpacing.md, vertical: AppSpacing.sm),
451+
horizontal: AppSpacing.md,
452+
vertical: AppSpacing.sm,
453+
),
424454
decoration: BoxDecoration(
425455
color: color.withValues(alpha: 0.12),
426456
borderRadius: BorderRadius.circular(AppSpacing.radiusMd),
427457
),
428-
child: Row(children: [
429-
Icon(icon, color: color, size: 20),
430-
const SizedBox(width: AppSpacing.xs),
431-
Expanded(
432-
child: Text(text, style: Theme.of(context).textTheme.bodyMedium)),
433-
]),
458+
child: Row(
459+
children: [
460+
Icon(icon, color: color, size: 20),
461+
const SizedBox(width: AppSpacing.xs),
462+
Expanded(
463+
child: Text(text, style: Theme.of(context).textTheme.bodyMedium),
464+
),
465+
],
466+
),
434467
);
435468
}
436469
}

macos/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
platform :osx, '10.14'
1+
platform :osx, '10.15'
22

33
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
44
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

macos/Podfile.lock

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
11
PODS:
2+
- app_links (1.0.0):
3+
- FlutterMacOS
24
- FlutterMacOS (1.0.0)
35
- shared_preferences_foundation (0.0.1):
46
- Flutter
57
- FlutterMacOS
8+
- url_launcher_macos (0.0.1):
9+
- FlutterMacOS
610

711
DEPENDENCIES:
12+
- app_links (from `Flutter/ephemeral/.symlinks/plugins/app_links/macos`)
813
- FlutterMacOS (from `Flutter/ephemeral`)
914
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
15+
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
1016

1117
EXTERNAL SOURCES:
18+
app_links:
19+
:path: Flutter/ephemeral/.symlinks/plugins/app_links/macos
1220
FlutterMacOS:
1321
:path: Flutter/ephemeral
1422
shared_preferences_foundation:
1523
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
24+
url_launcher_macos:
25+
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
1626

1727
SPEC CHECKSUMS:
18-
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
28+
app_links: 9028728e32c83a0831d9db8cf91c526d16cc5468
29+
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
1930
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
31+
url_launcher_macos: 0fba8ddabfc33ce0a9afe7c5fef5aab3d8d2d673
2032

21-
PODFILE CHECKSUM: 7eb978b976557c8c1cd717d8185ec483fd090a82
33+
PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009
2234

2335
COCOAPODS: 1.16.2

macos/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@
558558
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
559559
GCC_WARN_UNUSED_FUNCTION = YES;
560560
GCC_WARN_UNUSED_VARIABLE = YES;
561-
MACOSX_DEPLOYMENT_TARGET = 10.14;
561+
MACOSX_DEPLOYMENT_TARGET = 10.15;
562562
MTL_ENABLE_DEBUG_INFO = NO;
563563
SDKROOT = macosx;
564564
SWIFT_COMPILATION_MODE = wholemodule;
@@ -650,7 +650,7 @@
650650
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
651651
GCC_WARN_UNUSED_FUNCTION = YES;
652652
GCC_WARN_UNUSED_VARIABLE = YES;
653-
MACOSX_DEPLOYMENT_TARGET = 10.14;
653+
MACOSX_DEPLOYMENT_TARGET = 10.15;
654654
MTL_ENABLE_DEBUG_INFO = YES;
655655
ONLY_ACTIVE_ARCH = YES;
656656
SDKROOT = macosx;
@@ -700,7 +700,7 @@
700700
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
701701
GCC_WARN_UNUSED_FUNCTION = YES;
702702
GCC_WARN_UNUSED_VARIABLE = YES;
703-
MACOSX_DEPLOYMENT_TARGET = 10.14;
703+
MACOSX_DEPLOYMENT_TARGET = 10.15;
704704
MTL_ENABLE_DEBUG_INFO = NO;
705705
SDKROOT = macosx;
706706
SWIFT_COMPILATION_MODE = wholemodule;

0 commit comments

Comments
 (0)