Commit code. Update time: 2023-06-25
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// OnceNotice.dart
|
||||
//ignore_for_file: file_names
|
||||
import 'package:sail/pages/ProOnecePage.dart';
|
||||
|
||||
import '/pages/proPage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OnceNotice extends StatelessWidget {
|
||||
const OnceNotice({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
shadowColor: Colors.transparent,
|
||||
actions: const [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: CloseButton(),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: const ProOnecePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//ignore_for_file: file_names
|
||||
import '/model/UserPreference.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '/model/flags.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChooseLocationRoute extends StatelessWidget {
|
||||
const ChooseLocationRoute({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
shadowColor: Colors.transparent,
|
||||
title: const Text('Choose location'),
|
||||
),
|
||||
body: ListView.builder(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
itemCount: Flags.list.length,
|
||||
itemBuilder: (builder, index) => ListTile(
|
||||
onTap: () {
|
||||
Provider.of<UserPreference>(context, listen: false)
|
||||
.setlocationIndex(index);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
leading: SvgPicture.asset(
|
||||
'assets/flags/${Flags.list[index]['imagePath']}',
|
||||
width: 42,
|
||||
),
|
||||
title: Text(
|
||||
Flags.list[index]['name'] as String,
|
||||
style: Theme.of(context).primaryTextTheme.subtitle1,
|
||||
),
|
||||
trailing: Icon(
|
||||
Icons.navigate_next_rounded,
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//ignore_for_file: file_names
|
||||
import '/pages/proPage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ProRoute extends StatelessWidget {
|
||||
const ProRoute({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
shadowColor: Colors.transparent,
|
||||
actions: const [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: CloseButton(),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: const ProPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
//ignore_for_file: file_names
|
||||
import 'package:sail/constant/app_colors.dart';
|
||||
import 'package:sail/models/user_model.dart';
|
||||
import 'package:sail/routes/proRoute.dart';
|
||||
import 'package:sail/utils/navigator_util.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../model/themeCollection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SettingsRoute extends StatefulWidget {
|
||||
const SettingsRoute({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SettingsRoute> createState() => _SettingsRouteState();
|
||||
}
|
||||
|
||||
class _SettingsRouteState extends State<SettingsRoute> {
|
||||
int connectionValue = 0;
|
||||
bool killSwitch = false, proVpn = false, notifySwitch = false;
|
||||
List<String> connectionModes = ['IPSec', 'ISSR'];
|
||||
|
||||
setConnectionValue(int? value) {
|
||||
setState(() {
|
||||
connectionValue = value!;
|
||||
});
|
||||
}
|
||||
|
||||
customListTile(BuildContext context, String title, String icon,
|
||||
{Widget? trailing,
|
||||
Icon? sysicon,
|
||||
String? subtitle,
|
||||
VoidCallback? onTap}) =>
|
||||
ListTile(
|
||||
onTap: onTap ?? null,
|
||||
minLeadingWidth: 35,
|
||||
dense: true,
|
||||
contentPadding: EdgeInsets.only(left: 24),
|
||||
title:
|
||||
Text(title, style: Theme.of(context).primaryTextTheme.subtitle1),
|
||||
subtitle: subtitle != null
|
||||
? Text(
|
||||
subtitle,
|
||||
style: Theme.of(context).primaryTextTheme.caption,
|
||||
)
|
||||
: null,
|
||||
// leading: sysicon ??
|
||||
// SvgPicture.asset(
|
||||
// icon,
|
||||
// // color: Theme.of(context).colorScheme.secondary,
|
||||
// width: 24,
|
||||
// cacheColorFilter: true,
|
||||
// color: AppColors.greenColor,
|
||||
// alignment: Alignment.centerRight,
|
||||
// ),
|
||||
trailing: trailing ?? null);
|
||||
|
||||
upgradeButton(context) => GestureDetector(
|
||||
onTap: () => Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (builder) => const ProRoute())),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(65),
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColors.greenColor, Color.fromARGB(255, 9, 54, 21)],
|
||||
transform: GradientRotation(5))),
|
||||
child: Text(
|
||||
'Upgrade',
|
||||
style: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.bodyText1!
|
||||
.copyWith(color: Colors.white),
|
||||
),
|
||||
));
|
||||
|
||||
Divider get divider => Divider(
|
||||
indent: 16,
|
||||
endIndent: 16,
|
||||
color: Colors.grey.withAlpha(50),
|
||||
thickness: 1);
|
||||
|
||||
Future<void> _launchUrl(_url) async {
|
||||
if (!await launchUrl(_url)) {
|
||||
throw Exception('Could not launch $_url');
|
||||
}
|
||||
}
|
||||
|
||||
Column listTileSet(String title, String description, bool value,
|
||||
Function(bool)? onChanged) =>
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
divider,
|
||||
// const Divider(color: Colors.grey, thickness: 1),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 24),
|
||||
child: Text(title,
|
||||
style: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.subtitle1!
|
||||
.copyWith(color: Colors.grey)),
|
||||
),
|
||||
SwitchListTile(
|
||||
activeColor: AppColors.greenColor,
|
||||
inactiveTrackColor:
|
||||
Provider.of<ThemeCollection>(context).isDarkActive
|
||||
? AppColors.whiteColor.withAlpha(90)
|
||||
: const Color(0xffD7D6D9),
|
||||
contentPadding: EdgeInsets.only(left: 24),
|
||||
title: Text(
|
||||
description,
|
||||
style: Theme.of(context).primaryTextTheme.subtitle1,
|
||||
),
|
||||
value: value,
|
||||
onChanged: onChanged)
|
||||
]);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
UserModel userModel = Provider.of<UserModel>(context);
|
||||
bool isDarkTheme = Provider.of<ThemeCollection>(context).isDarkActive;
|
||||
var themeData = Provider.of<ThemeCollection>(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
shadowColor: Colors.transparent,
|
||||
title: const Text('Settings'),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0.0, vertical: 8.0),
|
||||
children: [
|
||||
/*Text('Connection Mode',
|
||||
style: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.subtitle1!
|
||||
.copyWith(color: Colors.grey)),
|
||||
const SizedBox(height: 4),
|
||||
Column(
|
||||
children: connectionModes.map((e) {
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
e,
|
||||
style: Theme.of(context).primaryTextTheme.subtitle1,
|
||||
),
|
||||
trailing: Radio(
|
||||
fillColor: MaterialStateProperty.all(
|
||||
connectionModes[connectionValue] != e
|
||||
? themeData.isDarkActive
|
||||
? Colors.white70
|
||||
: Colors.grey
|
||||
: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
value: connectionModes.indexOf(e),
|
||||
groupValue: connectionValue,
|
||||
onChanged: setConnectionValue),
|
||||
);
|
||||
}).toList()),
|
||||
listTileSet(
|
||||
'Kill Switch',
|
||||
'Block internet when connecting or changing servers',
|
||||
killSwitch,
|
||||
(value) => setState(() => killSwitch = value)),
|
||||
|
||||
listTileSet('Connection', 'Connect when VPN starts', proVpn,
|
||||
(value) => setState(() => proVpn = value)),*/
|
||||
listTileSet(
|
||||
'Notification',
|
||||
'Show notification when VPN is not connected.',
|
||||
notifySwitch,
|
||||
(value) => setState(() => notifySwitch = value)),
|
||||
listTileSet('Dark theme', 'Reduce glare & improve night viewing.',
|
||||
themeData.isDarkActive, (value) {
|
||||
themeData.setDarkTheme(value);
|
||||
}),
|
||||
divider,
|
||||
customListTile(context, 'Rate us', '',
|
||||
trailing: IconButton(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.arrow_forward_ios,
|
||||
size: 20,
|
||||
color: isDarkTheme
|
||||
? Color.fromARGB(255, 148, 145, 145)
|
||||
: Color.fromARGB(255, 190, 187, 187))),
|
||||
sysicon: Icon(Icons.rate_review,
|
||||
size: 30, color: AppColors.greenColor),
|
||||
onTap: () => _launchUrl(Uri.parse(
|
||||
"https://apps.apple.com/us/app/uuvpn-2023/id6449599228"))),
|
||||
divider,
|
||||
customListTile(context, 'Privacy policy', '',
|
||||
trailing: IconButton(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.arrow_forward_ios,
|
||||
size: 20,
|
||||
color: isDarkTheme
|
||||
? Color.fromARGB(255, 148, 145, 145)
|
||||
: Color.fromARGB(255, 190, 187, 187))),
|
||||
sysicon: Icon(Icons.private_connectivity,
|
||||
size: 30, color: AppColors.greenColor),
|
||||
onTap: () => NavigatorUtil.goWebView(context, "Privacy policy",
|
||||
"https://uuvpn.co/privacy-policy/")),
|
||||
divider,
|
||||
customListTile(context, 'Terms&Conditions', '',
|
||||
sysicon: Icon(Icons.format_align_center,
|
||||
size: 30, color: AppColors.greenColor),
|
||||
trailing: IconButton(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.arrow_forward_ios,
|
||||
size: 20,
|
||||
color: isDarkTheme
|
||||
? Color.fromARGB(255, 148, 145, 145)
|
||||
: Color.fromARGB(255, 190, 187, 187))), onTap: () {
|
||||
NavigatorUtil.goWebView(
|
||||
context, "Terms&Conditions", "https://uuvpn.co/terms/");
|
||||
}),
|
||||
divider,
|
||||
customListTile(context, 'Online Help', '',
|
||||
sysicon: Icon(Icons.format_align_center,
|
||||
size: 30, color: AppColors.greenColor),
|
||||
trailing: IconButton(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
onPressed: () {},
|
||||
icon: Icon(Icons.arrow_forward_ios,
|
||||
size: 20,
|
||||
color: isDarkTheme
|
||||
? Color.fromARGB(255, 148, 145, 145)
|
||||
: Color.fromARGB(255, 190, 187, 187))), onTap: () {
|
||||
// NavigatorUtil.goWebView(
|
||||
// context, "Terms&Conditions", "https://uuvpn.co/terms/");
|
||||
NavigatorUtil.goWebView(context, "Online Help",
|
||||
"https://go.crisp.chat/chat/embed/?website_id=3ed83170-f288-4c23-acd4-30c1e557948b&user_email=${userModel.userEntity?.email}");
|
||||
}),
|
||||
divider,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user