HomePage Design changes

This commit is contained in:
VINISTAN 2024-12-09 19:01:43 +05:30
parent c86f9663ed
commit 617379deef
12 changed files with 402 additions and 38 deletions

View File

@ -297,9 +297,9 @@ import 'package:go_router/go_router.dart';
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
import '../domain/use_cases/preferences_use_case.dart';
import '../presentation/Screens/changepassword.dart';
import '../presentation/Screens/confirm_password.dart';
import '../presentation/Screens/otp_verification.dart';
import '../presentation/Screens/auth_verification/changepassword.dart';
import '../presentation/Screens/auth_verification/confirm_password.dart';
import '../presentation/Screens/auth_verification/otp_verification.dart';
import '../presentation/Screens/profilepage.dart';
import '../presentation/routes/auth_routes/login_route.dart';
import '../presentation/routes/bottom_bar_routes/tab_routes/home_route.dart';
@ -352,6 +352,14 @@ final GoRouter router = GoRouter(
userId: '',
),
),
// GoRoute(
// path: '/manageuser',
// builder: (context, state) {
// // Retrieve the title from extra or query params
// final title = state.extra as String? ?? 'Manage users';
// return ManageUserRouter(title: title);
// },
// ),
GoRoute(
path: '/manageuser',
builder: (context, state) => ManageUserRouter(),

View File

@ -9,7 +9,7 @@ import 'package:uae_stat/config/old_theme.dart';
import 'package:uae_stat/domain/entities/language_locale.dart';
import 'package:uae_stat/domain/use_cases/auth_use_case.dart';
import 'package:uae_stat/presentation/Screens/profilepage.dart';
import 'package:uae_stat/presentation/Screens/registration.dart';
import 'package:uae_stat/presentation/Screens/auth_verification/registration.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();

View File

@ -6,8 +6,8 @@ import 'package:pocketbase/pocketbase.dart';
import 'package:uae_stat/domain/use_cases/language.dart';
import 'package:uae_stat/presentation/Screens/profilepage.dart';
import '../../infrastructure/services/pocketbase_service.dart';
import '../routes/auth_routes/login_route.dart';
import '../../../infrastructure/services/pocketbase_service.dart';
import '../../routes/auth_routes/login_route.dart';
class RegisterScreen extends StatefulWidget {
@override

View File

@ -10,7 +10,7 @@ import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'package:pocketbase/pocketbase.dart';
import 'changepassword.dart';
import 'auth_verification/changepassword.dart';
class ProfileScreen extends StatefulWidget {
final String userId; // Add this field to hold the user ID

View File

@ -18,7 +18,7 @@ import 'package:uae_stat/presentation/components/themed_text_field.dart';
import 'package:uae_stat/presentation/routes/bottom_bar_routes/tab_routes/home_route.dart';
import '../../Screens/profilepage.dart';
import '../../Screens/registration.dart';
import '../../Screens/auth_verification/registration.dart';
import 'package:pocketbase/pocketbase.dart';
class LoginRoute extends HookConsumerWidget {

View File

@ -173,9 +173,314 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
double myheight = MediaQuery.of(context).size.height;
double mywidth = MediaQuery.of(context).size.width;
return BaseScaffold(
body: Center(child : Text("Home Page"))
title: Center(child: SizedBox(height : myheight/5, width : mywidth/3,child: Image(image: AssetImage('assets/logos/uae_stat.png')))),
body: EconomyStats(),
);
}
}
class EconomyStats extends StatelessWidget {
const EconomyStats({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(left: 10,right: 10),
child: Column(
children: [
// Header Section
RoundedCornerContainer(
text: 'ECONOMY',
backgroundColor: Color(0xFF7DAFBC),
textStyle: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
// Grid Section
// ECONOMY DETAILS
Padding(
padding: const EdgeInsets.only(top: 10,),
child: Column(
children: [
// First Row
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InfoCard(
title: 'GDP (Constant)',
subtitle: '(2022) (AED)',
value: '1.62T',
bordercolor: Color(0xFF7DAFBC),
textcolor: Color(0xFF7DAFBC),
),
InfoCard(
title: 'Inflation Rate',
subtitle: '(2022)',
value: '4.82%',
bordercolor: Color(0xFF7DAFBC), textcolor: Color(0xFF7DAFBC),
),
],
),
const SizedBox(height: 10),
// Second Row
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InfoCard(
title: 'Trade Value',
subtitle: '(Jan - Jan 2024) - AED',
value: '215.4B',
bordercolor: Color(0xFF7DAFBC), textcolor: Color(0xFF7DAFBC),
),
InfoCard(
title: 'Hotel Guests',
subtitle: '(2022)',
value: '25.21M',
bordercolor: Color(0xFF7DAFBC), textcolor: Color(0xFF7DAFBC),
),
],
),
const SizedBox(height: 10),
RoundedCornerContainer(
text: 'SOCIAL',
backgroundColor: Colors.brown[200]!,
textStyle: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
// SOCIAL DETAILS
Padding(
padding: const EdgeInsets.only(top: 10,),
child: Column(
children: [
// First Row
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InfoCard(
title: 'Population',
subtitle: '(2022) (AED)',
value: '1.62T',
bordercolor: Colors.brown[200]!,
textcolor: Colors.brown[200]!,
),
InfoCard(
title: 'Labor Force',
subtitle: '(2022)',
value: '4.82%',
bordercolor: Colors.brown[200]!,
textcolor: Colors.brown[200]!,
),
],
),
const SizedBox(height: 10),
// Second Row
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InfoCard(
title: 'Hospitals (Gov )',
subtitle: '(Jan - Jan 2024) - AED',
value: '215.4B',
bordercolor: Colors.brown[200]!,
textcolor: Colors.brown[200]!,
),
InfoCard(
title: 'Schools',
subtitle: '(2022)',
value: '25.21M',
bordercolor: Colors.brown[200]!,
textcolor: Colors.brown[200]!,
),
],
),
const SizedBox(height: 10),
RoundedCornerContainer(
text: 'ENVIRONMENT',
backgroundColor: Color(0xFF7DAFBC),
textStyle: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
// ENVIRONMENT DETAILS
Padding(
padding: const EdgeInsets.only(top: 10,),
child: Column(
children: [
// First Row
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InfoCard(
title: 'Electricity',
subtitle: '(2022) (AED)',
value: '1.62T',
bordercolor: Color(0xFF7DAFBC),
textcolor: Color(0xFF7DAFBC),
),
InfoCard(
title: 'Cruid oil',
subtitle: '(2022)',
value: '4.82%',
bordercolor: Color(0xFF7DAFBC),
textcolor: Color(0xFF7DAFBC),
),
],
),
const SizedBox(height: 10),
// Second Row
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InfoCard(
title: 'Export of oil',
subtitle: '(Jan - Jan 2024) - AED',
value: '215.4B',
bordercolor: Color(0xFF7DAFBC),
textcolor: Color(0xFF7DAFBC),
),
InfoCard(
title: 'Desalinated water',
subtitle: '(2022)',
value: '25.21M',
bordercolor: Color(0xFF7DAFBC),
textcolor: Color(0xFF7DAFBC),
),
],
),
],
),
),
],
),
),
],
),
),
],
),
),
);
}
}
class RoundedCornerContainer extends StatelessWidget {
final String text;
final Color backgroundColor;
final TextStyle? textStyle;
const RoundedCornerContainer({
Key? key,
required this.text,
this.backgroundColor = Colors.blue,
this.textStyle,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.circular(12), // Rounded corners
),
child: Center(
child: Text(
text,
style: textStyle ??
const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
);
}
}
class InfoCard extends StatelessWidget {
final String title;
final String subtitle;
final String value;
final Color bordercolor;
final Color? textcolor;
const InfoCard({
Key? key,
required this.title,
required this.subtitle,
required this.value, required this.bordercolor,this.textcolor,
}) : super(key: key);
@override
Widget build(BuildContext context) {
double myheight = MediaQuery.of(context).size.height;
double mywidth = MediaQuery.of(context).size.width;
return Expanded(
child:
Container(
height: myheight/9,
width: mywidth/4,
margin: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
border: Border.all(color: bordercolor),
borderRadius: BorderRadius.circular(8),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: Text(
title,
//textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
const SizedBox(height: 2),
Text(
subtitle,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
const SizedBox(height: 2),
Text(
value,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: textcolor ?? Colors.black
),
),
],
),
),
);
}
}

View File

@ -192,6 +192,7 @@ class _FeedbackFormState extends State<FeedbackForm>
@override
Widget build(BuildContext context) {
return BaseScaffold(
title: Text("Feedback"),
// appBar: AppBar(
// backgroundColor: const Color(0xFFf8f9ff),
// title: Text(context.translate('Feedback Form', 'نموذج الملاحظات')),

View File

@ -4,6 +4,7 @@ import 'package:uae_stat/presentation/components/my_drawer.dart';
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
class ManageUserRouter extends StatefulWidget {
late final Widget title;
@override
State<ManageUserRouter> createState() => _ManageUserRouterState();
}
@ -150,6 +151,7 @@ class _ManageUserRouterState extends State<ManageUserRouter> {
Widget build(BuildContext context) {
double myheight = MediaQuery.of(context).size.height;
return BaseScaffold(
title: Text("Manage User"),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0, top: 3.0),

View File

@ -1,72 +1,122 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class BaseScaffold extends StatelessWidget {
final Widget body;
final Widget title;
final List<Widget>? actions;
const BaseScaffold({required this.body});
const BaseScaffold({
Key? key,
required this.body,
required this.title,
this.actions,
}) : super(key: key);
// final Widget body;
//
// const BaseScaffold({required this.body});
@override
Widget build(BuildContext context) {
// Get the current route to highlight the active item
String currentRoute = GoRouterState.of(context).matchedLocation;
double myheight = MediaQuery.of(context).size.height;
double mywidth = MediaQuery.of(context).size.width;
return Scaffold(
appBar: AppBar(title: Text(""),),
drawer: Drawer(
appBar: AppBar(
title: title,
actions: [IconButton(onPressed: (){}, icon: Icon(Icons.toggle_off_outlined)),
]),
drawer: Drawer(
child: ListView(
children: [
DrawerHeader(
decoration: BoxDecoration(color: Colors.blue),
//decoration: BoxDecoration(color: Colors.blue),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(children: [
],)
Row(
children: [
SizedBox(
width: mywidth / 8,
child: Image(
image: AssetImage('assets/logos/fcsc.png'))),
],
),
Divider(),
ListTile()
InkWell(
onTap: () => context.go('/profile'),
child: Row(
children: [
SizedBox(
width: mywidth / 8,
child: Image(
image: AssetImage(
'assets/edit_profile/profile.png'))),
SizedBox(
width: mywidth / 20,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Mohammad'),
Text('Mohammad@fcsc.com')
],
)
],
),
)
],
),
//child: Text('Drawer Header', style: TextStyle(color: Colors.white, fontSize: 24)),
),
ListTile(
leading: Icon(Icons.person),
title: Text('Profile'),
onTap: () => context.go('/profile'),
),
ListTile(
leading: Icon(Icons.note),
leading: SizedBox(
height: myheight / 15,
width: mywidth / 15,
child: Image(
image: AssetImage('assets/icons/drawer/message.png'))),
title: Text('Feedback'),
onTap: () => context.go('/feedback'),
),
ListTile(
leading : Icon(Icons.percent),
leading: SizedBox(
height: myheight / 15,
width: mywidth / 15,
child: Image(
image: AssetImage('assets/icons/drawer/manageuser.png'))),
title: Text('Manage User'),
onTap: () => context.go('/manageuser'),
),
],
),
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _getSelectedIndex(currentRoute),
onTap: (index) => _onItemTapped(context, index),
type: BottomNavigationBarType.fixed,
items: [
BottomNavigationBarItem(icon: Icon(Icons.home,color: Colors.black,), label: 'Home',),
BottomNavigationBarItem(icon: Icon(Icons.info,color: Colors.black,), label: 'About',),
BottomNavigationBarItem(icon: Icon(Icons.settings,color: Colors.black,), label: 'Settings'),
BottomNavigationBarItem(icon: Icon(Icons.person,color: Colors.black,), label: 'Profile'),
BottomNavigationBarItem(
icon: SizedBox(height: myheight/15,width : mywidth/15,child: Image(image: AssetImage('assets/icons/bottom_bar/home.png'))),
label: 'Home',
),
BottomNavigationBarItem(
icon: SizedBox(height: myheight/15,width : mywidth/15,child: Image(image: AssetImage('assets/icons/bottom_bar/uae_map.png'))),
label: 'UAE Numbers',
),
BottomNavigationBarItem(
icon: SizedBox(height: myheight/15,width : mywidth/15,child: Image(image: AssetImage('assets/icons/bottom_bar/ranking.png'))),
label: 'Competitiveness'),
BottomNavigationBarItem(
icon: SizedBox(height: myheight/15,width : mywidth/15,child: Image(image: AssetImage('assets/icons/bottom_bar/globe.png'))),
label: 'Country Profile'),
],
selectedItemColor: Colors.blue,
selectedItemColor: Colors.black,
unselectedItemColor: Colors.grey,
showUnselectedLabels: true,
),
body: body,
);
}
@ -104,5 +154,3 @@ class BaseScaffold extends StatelessWidget {
}
}
}