Policy UI
This commit is contained in:
parent
7d684e86b3
commit
c8f2d798ea
291
lib/Screens/policy/policy.dart
Normal file
291
lib/Screens/policy/policy.dart
Normal file
@ -0,0 +1,291 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:responsive_builder/responsive_builder.dart';
|
||||
|
||||
import '../../routes/custom_appBar.dart';
|
||||
import '../../routes/custom_drawer.dart';
|
||||
|
||||
class Policy extends StatefulWidget{
|
||||
|
||||
const Policy ({super.key});
|
||||
|
||||
@override
|
||||
_PolicyState createState() => _PolicyState();
|
||||
}
|
||||
|
||||
class _PolicyState extends State<Policy>{
|
||||
|
||||
late String policyType = "domestic";
|
||||
int? selectedServiceIndex = 1;
|
||||
late String selectedService;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
||||
bool isDesktop = sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildPolicyLayout(isDesktop))
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget buildPolicyLayout(bool isDesktop){
|
||||
return Container(
|
||||
margin: EdgeInsets.all(20.0),
|
||||
height: MediaQuery.of(context).size.height,
|
||||
// color: Colors.grey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
// color: Color(0xFFF7F7FB),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
|
||||
child: Container(
|
||||
// color: Colors.amber,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
padding: EdgeInsets.all(5),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"Choose Policy Type",
|
||||
style: TextStyle(fontSize: 20,),
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 10,),
|
||||
|
||||
Row (
|
||||
children: [
|
||||
Expanded(
|
||||
|
||||
child: GestureDetector(
|
||||
onTap: (){ setState(() {
|
||||
policyType = "domestic";
|
||||
});},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
color: policyType == "domestic" ? Colors.blueAccent.shade100 : Color(0xFFEBEBF7),
|
||||
// color: Colors.blue.shade300,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"Domestic",
|
||||
style: TextStyle(color: policyType == "domestic" ? Colors.white :Colors.black87, fontSize: 18,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
||||
child: GestureDetector(
|
||||
onTap: (){ setState(() {
|
||||
policyType = "international";
|
||||
});},
|
||||
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
// color: Color(0xFFEBEBF7),
|
||||
color: policyType == "international" ? Colors.blueAccent.shade100 : Color(0xFFEBEBF7),
|
||||
// color: Color(0xFFE3F2FD),
|
||||
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"International",
|
||||
style: TextStyle(color: policyType == "international" ? Colors.white :Colors.black87, fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
isDesktop ?
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
|
||||
_buildPolicyCategoryList(isDesktop),
|
||||
_buildPolicyCategory(isDesktop),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
: Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildPolicyCategoryList(isDesktop),
|
||||
_buildPolicyCategory(isDesktop),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _buildPolicyCategoryList(bool isDesktop){
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
// color: Colors.blueGrey.shade200,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null,
|
||||
child: isDesktop ? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
_buildPolicySubCategoryList(isDesktop)
|
||||
|
||||
],
|
||||
)
|
||||
: Container(
|
||||
// color: Colors.amber,
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
_buildPolicySubCategoryList(isDesktop)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPolicySubCategoryList(bool isDesktop) {
|
||||
List<String> services = [
|
||||
"Flight", "Train", "Bus", "Taxi", "Forex","Accommodation",
|
||||
"Insurance", "Visa", "Miscellaneous"
|
||||
];
|
||||
|
||||
return Expanded(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: isDesktop ? Axis.vertical : Axis.horizontal,
|
||||
child: Flex(
|
||||
direction: isDesktop ? Axis.vertical : Axis.horizontal,
|
||||
|
||||
children: services.asMap().entries.map((entry) {
|
||||
|
||||
int index = entry.key;
|
||||
String service = entry.value;
|
||||
bool isSelected = selectedServiceIndex == index;
|
||||
|
||||
return SizedBox(
|
||||
width: 180,
|
||||
height: isDesktop? 65 : 50,
|
||||
child:GestureDetector(
|
||||
onTap :(){
|
||||
print("Selected Services - $service - $index");
|
||||
setState(() {
|
||||
selectedServiceIndex = index;
|
||||
selectedService = service;
|
||||
});
|
||||
},
|
||||
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(8),
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.blue,
|
||||
color: isSelected ? Colors.blueAccent.shade100 : Color(0xFFEBEBF7),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
service,
|
||||
style: TextStyle(color: isSelected ? Colors.white : Colors.black87,
|
||||
fontSize: 13,
|
||||
fontWeight: isSelected ? FontWeight.bold :FontWeight.w100),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}).toList(),
|
||||
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _buildPolicyCategory(bool isDesktop){
|
||||
return Expanded(
|
||||
child: Container(
|
||||
color: Colors.brown.shade100,
|
||||
// color: Colors.white60,
|
||||
|
||||
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Text(
|
||||
"policy Data 1"
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
Expanded(
|
||||
child: Container(
|
||||
color: Colors.brown.shade200,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Text(
|
||||
"policy Data 2"
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
0
lib/Screens/policy/policyCriteria.dart
Normal file
0
lib/Screens/policy/policyCriteria.dart
Normal file
@ -150,6 +150,11 @@ class _CustomDrawerState extends State<CustomDrawer>{
|
||||
_buildSubDrawerItem(context,'User List','/listUser'),
|
||||
// _buildSubDrawerItem(context,'PlanB','/PlanB')
|
||||
]),
|
||||
|
||||
_buildExpandableItem(context,Icons.policy,'Policy ',[
|
||||
_buildSubDrawerItem(context,'Policy','/Policy'),
|
||||
// _buildSubDrawerItem(context,'PlanB','/PlanB')
|
||||
]),
|
||||
_buildDrawerItem(context,Icons.logout,'Logout','/')
|
||||
],
|
||||
),
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:frontend/Screens/authentication/loginPage1.dart';
|
||||
import 'package:frontend/Screens/dashboard/home_page.dart';
|
||||
import 'package:frontend/Screens/plans/create_plans.dart';
|
||||
import 'package:frontend/Screens/plans/list_plans.dart';
|
||||
import 'package:frontend/Screens/policy/policy.dart';
|
||||
import 'package:frontend/Screens/userManagement/create_user/create_user.dart';
|
||||
import 'package:frontend/Screens/userManagement/user_List.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@ -22,7 +23,8 @@ final GoRouter router = GoRouter(
|
||||
GoRoute(
|
||||
path: '/listPlan',
|
||||
builder: (context, state) => ListPlans(),
|
||||
), GoRoute(
|
||||
),
|
||||
GoRoute(
|
||||
path: '/createPlan',
|
||||
builder: (context, state) => CreatePlan(),
|
||||
),
|
||||
@ -34,5 +36,10 @@ final GoRouter router = GoRouter(
|
||||
path: '/CreateUserDetails',
|
||||
builder: (context, state) => CreateUserForm(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/Policy',
|
||||
builder: (context,state) => Policy(),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
Loading…
Reference in New Issue
Block a user