Files
GSFV2/gsf/lib/views/pages/settings/setting_main.dart
2024-06-25 12:55:48 +05:30

151 lines
4.2 KiB
Dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:gsp_app/views/pages/settings/ratings.dart';
import 'package:package_info_plus/package_info_plus.dart';
import '../../components/appbar.dart';
import '../../theme.dart';
import '../feedback/feedback.dart';
import 'accounts.dart';
class Settings extends StatefulWidget {
Settings({Key? key}) : super(key: key);
@override
State<Settings> createState() => _SettingsState();
}
class _SettingsState extends State<Settings> {
PackageInfo? packageInfo;
initPackageinfo() async {
packageInfo = await PackageInfo.fromPlatform();
}
@override
void initState() {
initPackageinfo();
super.initState();
}
@override
Widget build(BuildContext context) {
final brightness = Get.theme.brightness;
return Scaffold(
// backgroundColor: ColorConstants.kBlack,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: CustomAppBars(titleHead: 'Setting'),
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 20),
accountsTab(
'Account',
() {
Get.to(() => const Accounts());
},
),
const SizedBox(height: 10),
accountsTab(
'Rate Us',
() {
Get.to(
() => const Ratings(),
);
},
),
const SizedBox(height: 10),
accountsTab(
'Feedback',
() {
Get.to(
() => const FeedBack(),
);
},
),
const SizedBox(height: 10),
Row(
children: [
Text(
'App Version',
style: TextStyle(
fontSize: 19,
color: (brightness == Brightness.light)
? ColorConstants.kBlack
: const Color(0xffD9D9D9),
),
),
const Spacer(),
if (Platform.isIOS)
Text(
packageInfo?.version ?? "1.5.10",
style: TextStyle(
fontSize: 19,
color: (brightness == Brightness.light)
? ColorConstants.kBlack
: const Color(0xff979292),
),
),
if (Platform.isAndroid)
Text(
packageInfo?.buildNumber ?? "21",
style: TextStyle(
fontSize: 19,
color: (brightness == Brightness.light)
? ColorConstants.kBlack
: const Color(0xff979292),
),
),
],
),
],
),
),
);
}
accountsTab(String title, VoidCallback ontap) {
final brightness = Get.theme.brightness;
return InkWell(
onTap: ontap,
child: Container(
height: 50,
width: Get.size.width,
decoration: BoxDecoration(
color: (brightness == Brightness.light)
? Colors.white
: const Color(0xff212121),
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: ColorConstants.kBlack.withOpacity(0.1),
blurRadius: 10,
spreadRadius: 2,
),
],
),
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Text(
title,
style: TextStyle(
fontSize: 19,
color: (brightness == Brightness.light)
? ColorConstants.kBlack
: const Color(0xffD9D9D9),
),
),
),
),
),
);
}
}