Skip to content

Commit ebe9b3c

Browse files
committed
Merge branch 'development' of https://github.com/VPNclient/VPNclient-app into development
2 parents f5f79a8 + febd7e6 commit ebe9b3c

8 files changed

Lines changed: 920 additions & 13 deletions

File tree

.github/workflows/quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
with:
1212
flutter-version: ${{ env.FLUTTER_VERSION }}
1313
- run: flutter pub get
14-
- run: flutter format --set-exit-if-changed .
14+
- run: dart format --set-exit-if-changed .
1515
- run: flutter analyze
1616
- name: Run Dart Code Metrics
1717
run: |
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:flutter/material.dart';
3+
4+
class AppListItem extends StatelessWidget {
5+
final IconData? icon;
6+
final dynamic image;
7+
final String text;
8+
final bool isSwitch;
9+
final bool isActive;
10+
final bool isEnabled;
11+
final VoidCallback onTap;
12+
13+
const AppListItem({
14+
super.key,
15+
this.icon,
16+
this.image,
17+
required this.text,
18+
required this.isSwitch,
19+
required this.isActive,
20+
required this.isEnabled,
21+
required this.onTap,
22+
});
23+
24+
@override
25+
Widget build(BuildContext context) {
26+
Color getColor(Set<WidgetState> states) {
27+
return Theme.of(context).colorScheme.primary;
28+
}
29+
30+
return GestureDetector(
31+
onTap: isEnabled ? onTap : null,
32+
child: Container(
33+
height: 52,
34+
margin: const EdgeInsets.symmetric(vertical: 8),
35+
decoration: BoxDecoration(
36+
color: Colors.white,
37+
borderRadius: BorderRadius.circular(10),
38+
boxShadow: [
39+
BoxShadow(
40+
<<<<<<< HEAD
41+
color: Colors.grey.withValues(alpha: 0.2),
42+
||||||| parent of f5f79a8 (fix quality check)
43+
color: Colors.grey.withAlpha((255 * 0.2).toInt()),
44+
=======
45+
color: Colors.grey.withAlpha((255 * 0.2).toInt()),
46+
>>>>>>> f5f79a8 (fix quality check)
47+
blurRadius: 10,
48+
offset: const Offset(0, 1),
49+
),
50+
],
51+
),
52+
child: Stack(
53+
children: [
54+
Padding(
55+
padding: const EdgeInsets.all(0),
56+
child: Row(
57+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
58+
children: [
59+
Row(
60+
children: [
61+
if (icon != null)
62+
Icon(
63+
icon,
64+
size: 52,
65+
color: Theme.of(context).colorScheme.primary,
66+
),
67+
if (image != null)
68+
image is String
69+
? Image.asset(image!, width: 52, height: 52)
70+
: Image.memory(image!, width: 52, height: 52),
71+
if (icon == null && image == null)
72+
const SizedBox(width: 16),
73+
Container(
74+
alignment: Alignment.center,
75+
height: 52,
76+
child: Text(
77+
text,
78+
style: const TextStyle(
79+
fontSize: 16,
80+
color: Colors.black,
81+
),
82+
),
83+
),
84+
],
85+
),
86+
isSwitch
87+
? Transform.scale(
88+
scale: 0.7,
89+
child: CupertinoSwitch(
90+
value: isActive,
91+
onChanged: null,
92+
inactiveTrackColor:
93+
Theme.of(context).colorScheme.onSecondary,
94+
),
95+
)
96+
: Checkbox(
97+
value: isActive,
98+
onChanged: null,
99+
checkColor: Colors.white,
100+
fillColor: WidgetStateProperty.resolveWith((states) {
101+
if (!isActive) {
102+
return Theme.of(context).colorScheme.onSecondary;
103+
}
104+
return getColor(states);
105+
}),
106+
shape: RoundedRectangleBorder(
107+
borderRadius: BorderRadius.circular(4),
108+
),
109+
side: WidgetStateBorderSide.resolveWith((states) {
110+
return BorderSide(
111+
color: Theme.of(context).colorScheme.onSecondary,
112+
width: 0.0,
113+
);
114+
}),
115+
),
116+
],
117+
),
118+
),
119+
if (!isEnabled)
120+
Container(
121+
decoration: BoxDecoration(
122+
<<<<<<< HEAD
123+
color: Colors.grey.withValues(alpha: 0.4),
124+
||||||| parent of f5f79a8 (fix quality check)
125+
color: Colors.grey.withAlpha((255 * 0.2).toInt()),
126+
=======
127+
color: Colors.grey.withAlpha((255 * 0.2).toInt()),
128+
>>>>>>> f5f79a8 (fix quality check)
129+
borderRadius: BorderRadius.circular(10),
130+
),
131+
),
132+
],
133+
),
134+
),
135+
);
136+
}
137+
}

lib/pages/main/main_btn.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:async';
2-
import 'dart:developer' as dev;
2+
import 'dart:developer';
3+
import 'dart:developer';
34
import 'package:flutter/material.dart';
45
import 'package:vpn_client/design/colors.dart';
56
import 'package:vpn_client/design/dimensions.dart';
@@ -127,7 +128,7 @@ class MainBtnState extends State<MainBtn> with SingleTickerProviderStateMixin {
127128
V2RayURL parser = FlutterV2ray.parseFromURL(link);
128129

129130
// Get Server Delay
130-
dev.log(
131+
log(
131132
'${flutterV2ray.getServerDelay(config: parser.getFullConfiguration())}ms',
132133
name: 'ServerDelay',
133134
);
@@ -156,7 +157,7 @@ class MainBtnState extends State<MainBtn> with SingleTickerProviderStateMixin {
156157
// >>>>>>> Stashed changes
157158
VPNclientEngine.pingServer(subscriptionIndex: 0, index: 1);
158159
VPNclientEngine.onPingResult.listen((result) {
159-
dev.log(
160+
log(
160161
"Ping result: ${result.latencyInMs} ms",
161162
name: 'PingLogger',
162163
); // <- Use dev.log instead of print.(It build to log meta data)

0 commit comments

Comments
 (0)