Initial commit of Flutter project

This commit is contained in:
2025-09-19 11:30:38 +05:30
parent 1f0ec17edc
commit 4a9ae0a3b3
28 changed files with 2033 additions and 594 deletions

View File

@@ -1,15 +1,41 @@
import 'package:flutter/material.dart';
import 'package:glowwheels/screens/privacy_policy_screen.dart';
import 'package:glowwheels/screens/profile_details_screen.dart';
import 'package:glowwheels/helpers/shopid_helper.dart';
import 'package:glowwheels/provider/shop_profile_provider.dart';
import 'package:glowwheels/provider/shop_provider.dart';
import 'package:glowwheels/screens/login_screen.dart';
import 'package:provider/provider.dart';
import 'package:glowwheels/screens/terms_condition_screen.dart';
import 'package:glowwheels/widgets/profile_header.dart';
import 'package:google_fonts/google_fonts.dart';
class AccountScreen extends StatelessWidget {
import 'package:glowwheels/screens/profile_details_screen.dart';
import 'package:glowwheels/screens/privacy_policy_screen.dart';
import 'package:glowwheels/screens/terms_condition_screen.dart';
class AccountScreen extends StatefulWidget {
const AccountScreen({super.key});
@override
State<AccountScreen> createState() => _AccountScreenState();
}
class _AccountScreenState extends State<AccountScreen> {
bool _isInit = true;
@override
void didChangeDependencies() {
super.didChangeDependencies();
if (_isInit) {
// Fetch the shop profile once when screen loads
final shopId=getShopId(context);
Provider.of<ShopProfileProvider>(context, listen: false).fetchShopProfile(shopId!);
_isInit = false;
}
}
@override
Widget build(BuildContext context) {
final shopProfileProvider = Provider.of<ShopProfileProvider>(context);
final shopProfile = shopProfileProvider.shopProfile;
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
@@ -20,7 +46,6 @@ class AccountScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: const [
ImageIcon(AssetImage("assets/icon/account_icon.png")),
SizedBox(width: 8),
Text(
"Account",
@@ -33,15 +58,17 @@ class AccountScreen extends StatelessWidget {
padding: const EdgeInsets.all(16),
child: Column(
children: [
// Profile Info
ProfileHeader(),
// Profile Info (shows shimmer skeleton if loading)
ProfileHeader(shopProfile: shopProfile),
const SizedBox(height: 24),
// Section Title
Align(
alignment: Alignment.centerLeft,
child: Text("Options",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
child: Text(
"Options",
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
),
const SizedBox(height: 12),
@@ -51,7 +78,7 @@ class AccountScreen extends StatelessWidget {
title: "Profile Details",
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => ServiceCenterDetailsScreen()),
MaterialPageRoute(builder: (_) => ServiceCenterDetailsScreen()),
);
},
),
@@ -60,7 +87,7 @@ class AccountScreen extends StatelessWidget {
title: "Terms and Conditions",
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => TermsOfServiceScreen()),
MaterialPageRoute(builder: (_) => TermsOfServiceScreen()),
);
},
),
@@ -69,14 +96,21 @@ class AccountScreen extends StatelessWidget {
title: "Privacy Policy",
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => PrivacyPolicyScreen()),
MaterialPageRoute(builder: (_) => PrivacyPolicyScreen()),
);
},
),
OptionTile(
icon: "assets/icon/logout_icon.png",
title: "Log Out",
onTap: () {},
onTap: () async{
await Provider.of<ShopProvider>(context, listen: false).logout();
Navigator.of(context, rootNavigator: true).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => LoginScreen()),
(route) => false,
);
},
isDestructive: true,
),
],
@@ -103,19 +137,20 @@ class OptionTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
color: isDestructive ? Colors.white : Colors.white,
color: Colors.white,
elevation: 0.5,
margin: const EdgeInsets.symmetric(vertical: 6),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: ListTile(
leading: ImageIcon(AssetImage(icon),
color: Color.fromRGBO(25, 25, 112, 1)),
title: Text(title,
style: GoogleFonts.inter(
fontSize: 14,color: Color.fromRGBO(41, 45, 50, 1)
,fontWeight: FontWeight.w500
),),
leading: ImageIcon(AssetImage(icon), color: const Color.fromRGBO(25, 25, 112, 1)),
title: Text(
title,
style: const TextStyle(
fontSize: 14,
color: Color.fromRGBO(41, 45, 50, 1),
fontWeight: FontWeight.w500,
),
),
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
onTap: onTap,
),