This commit is contained in:
Venba 2024-06-14 09:53:25 +05:30
parent 86cd662522
commit 17280b1bb8
5 changed files with 225 additions and 180 deletions

View File

@ -11,24 +11,32 @@ fi
# Copy the .env.development file to .env # Copy the .env.development file to .env
cp $ENV_FILE_PATH .env cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file # Verify .env file contains correct values
if ! grep -q BASE_HREF .env; then source .env
echo "BASE_HREF not found in .env file"
exit 1
fi
# Extract the BASE_HREF value
BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2)
# Check if the BASE_HREF value is empty
if [ -z "$BASE_HREF" ]; then if [ -z "$BASE_HREF" ]; then
echo "BASE_HREF value is empty" echo "BASE_HREF value is empty"
exit 1 exit 1
fi fi
if [ -z "$API_URL" ]; then
echo "API_URL value is empty"
exit 1
fi
# Print loaded values for verification
echo "Loaded BASE_HREF: $BASE_HREF"
echo "Loaded API_URL: $API_URL"
# Build the web app for development with base href # Build the web app for development with base href
flutter build web --release --base-href "$BASE_HREF" flutter build web --release --base-href "$BASE_HREF"
# Optionally, remove the .env file after the build # Check if the build was successful
# rm .env if [ $? -ne 0 ]; then
echo "Flutter dev build failed"
exit 1
fi
echo "Flutter dev build succeeded"

View File

@ -1,34 +1,42 @@
#!/bin/bash #!/bin/bash
# Define the path to the .env file for production # Define the path to the .env.production file
ENV_FILE_PATH=".env.production" ENV_FILE_PATH=".env.production"
# Check if the .env file exists # Check if the .env.production file exists
if [ ! -f $ENV_FILE_PATH ]; then if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist" echo "$ENV_FILE_PATH does not exist"
exit 1 exit 1
fi fi
# Copy the .env file for production to .env # Copy the .env.production file to .env
cp $ENV_FILE_PATH .env cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file # Verify .env file contains correct values
if ! grep -q BASE_HREF .env; then source .env
echo "BASE_HREF not found in .env file"
exit 1
fi
# Extract the BASE_HREF value
BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2)
# Check if the BASE_HREF value is empty
if [ -z "$BASE_HREF" ]; then if [ -z "$BASE_HREF" ]; then
echo "BASE_HREF value is empty" echo "BASE_HREF value is empty"
exit 1 exit 1
fi fi
# Build the web app for production environment with base href if [ -z "$API_URL" ]; then
echo "API_URL value is empty"
exit 1
fi
# Print loaded values for verification
echo "Loaded BASE_HREF: $BASE_HREF"
echo "Loaded API_URL: $API_URL"
# Build the web app for production with base href
flutter build web --release --base-href "$BASE_HREF" flutter build web --release --base-href "$BASE_HREF"
# Optionally, remove the .env file after the build # Check if the build was successful
# rm .env if [ $? -ne 0 ]; then
echo "Flutter prod build failed"
exit 1
fi
echo "Flutter prod build succeeded"

View File

@ -1,34 +1,42 @@
#!/bin/bash #!/bin/bash
# Define the path to the .env file for testing # Define the path to the .env.test file
ENV_FILE_PATH=".env.test" ENV_FILE_PATH=".env.test"
# Check if the .env file exists # Check if the .env.test file exists
if [ ! -f $ENV_FILE_PATH ]; then if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist" echo "$ENV_FILE_PATH does not exist"
exit 1 exit 1
fi fi
# Copy the .env file for testing to .env # Copy the .env.test file to .env
cp $ENV_FILE_PATH .env cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file # Verify .env file contains correct values
if ! grep -q BASE_HREF .env; then source .env
echo "BASE_HREF not found in .env file"
exit 1
fi
# Extract the BASE_HREF value
BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2)
# Check if the BASE_HREF value is empty
if [ -z "$BASE_HREF" ]; then if [ -z "$BASE_HREF" ]; then
echo "BASE_HREF value is empty" echo "BASE_HREF value is empty"
exit 1 exit 1
fi fi
# Build the web app for test environment with base href if [ -z "$API_URL" ]; then
echo "API_URL value is empty"
exit 1
fi
# Print loaded values for verification
echo "Loaded BASE_HREF: $BASE_HREF"
echo "Loaded API_URL: $API_URL"
# Build the web app for the test environment with base href
flutter build web --release --base-href "$BASE_HREF" flutter build web --release --base-href "$BASE_HREF"
# Optionally, remove the .env file after the build # Check if the build was successful
# rm .env if [ $? -ne 0 ]; then
echo "Flutter test build failed"
exit 1
fi
echo "Flutter test build succeeded"

View File

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
@ -451,155 +452,168 @@ class _hrDashboardState extends State<hrDashboard> {
), ),
), ),
SizedBox(height: 8), SizedBox(height: 8),
Row( SingleChildScrollView(
children: List.generate( scrollDirection:
policyDetails.length, Axis.horizontal,
(index) => Container( controller:
width: 300, ScrollController(), // Adding ScrollController
height: policyHeight, dragStartBehavior:
child: GestureDetector( DragStartBehavior.start,
onTap: () { child: Row(
Navigator.pushNamed( children: List.generate(
context, policyDetails.length,
'hrPolicyDetails', (index) => Container(
arguments: width: 300,
policyDetails[ height: policyHeight,
index]); child: GestureDetector(
}, onTap: () {
child: MouseRegion( Navigator.pushNamed(
cursor: context,
SystemMouseCursors 'hrPolicyDetails',
.click, arguments:
child: Card( policyDetails[
elevation: 3, index]);
color: },
cardColor, // Use the determined color child: MouseRegion(
child: Column( cursor:
crossAxisAlignment: SystemMouseCursors
CrossAxisAlignment .click,
.start, child: Card(
children: [ elevation: 3,
ListTile( color:
title: cardColor, // Use the determined color
SizedBox( child: Column(
height: 50, crossAxisAlignment:
child: Text( CrossAxisAlignment
'${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})', .start,
style: GoogleFonts children: [
.poppins( ListTile(
fontSize: title:
16, SizedBox(
fontWeight: height:
FontWeight.w500, 50,
color: Color( child:
0xFF000000), Text(
height: '${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})',
1.5, style: GoogleFonts
.poppins(
fontSize:
16,
fontWeight:
FontWeight.w500,
color:
Color(0xFF000000),
height:
1.5,
),
softWrap:
true, // Allow text to wrap to the next line if needed
), ),
softWrap:
true, // Allow text to wrap to the next line if needed
), ),
), ),
), SizedBox(
SizedBox( height:
height: 8), 8),
Padding( Padding(
padding: EdgeInsets padding: EdgeInsets.only(
.only( left:
left: 15,
15, right:
right: 15),
15), child: Row(
child: Row( children: [
children: [ Expanded(
Expanded( flex:
flex: 4, 4,
child: child:
Column( Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
children: [ children: [
Text( Text(
'Draft', 'Draft',
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF000000), color: Color(0xFF000000),
height: 1.5, height: 1.5,
),
), ),
), Text(
Text( policyDetails[index]['membersCountOfDraft'].toString(),
policyDetails[index]['membersCountOfDraft'].toString(), style: GoogleFonts.poppins(
style: GoogleFonts.poppins( fontSize: 16,
fontSize: 16, fontWeight: FontWeight.w400,
fontWeight: FontWeight.w400, color: Color(0xFF000000),
color: Color(0xFF000000), height: 1.5,
height: 1.5, ),
), ),
), ],
], ),
), ),
), Expanded(
Expanded( flex:
flex: 4, 4,
child: child:
Column( Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
children: [ children: [
Text( Text(
'Enrolled', 'Enrolled',
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF000000), color: Color(0xFF000000),
height: 1.5, height: 1.5,
),
), ),
), Text(
Text( policyDetails[index]['membersCountOfEnrolled'].toString(),
policyDetails[index]['membersCountOfEnrolled'].toString(), style: GoogleFonts.poppins(
style: GoogleFonts.poppins( fontSize: 16,
fontSize: 16, fontWeight: FontWeight.w400,
fontWeight: FontWeight.w400, color: Color(0xFF000000),
color: Color(0xFF000000), height: 1.5,
height: 1.5, ),
), ),
), ],
], ),
), ),
), Expanded(
Expanded( flex:
flex: 4, 4,
child: child:
Column( Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
children: [ children: [
Text( Text(
'Total', 'Total',
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF000000), color: Color(0xFF000000),
height: 1.5, height: 1.5,
),
), ),
), Text(
Text( policyDetails[index]['totalMembersCount'].toString(),
policyDetails[index]['totalMembersCount'].toString(), style: GoogleFonts.poppins(
style: GoogleFonts.poppins( fontSize: 16,
fontSize: 16, fontWeight: FontWeight.w400,
fontWeight: FontWeight.w400, color: Color(0xFF000000),
color: Color(0xFF000000), height: 1.5,
height: 1.5, ),
), ),
), ],
], ),
), ),
), ],
], ), // Adjust the horizontal padding as needed
), // Adjust the horizontal padding as needed )
) ],
], ),
), ),
), ),
), ),

View File

@ -1,12 +1,14 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../home.dart';
class Environment { class Environment {
static String get fileName { static String get fileName {
const bool isProduction = const bool isProduction =
bool.fromEnvironment('dart.vm.product', defaultValue: false); bool.fromEnvironment('dart.vm.product', defaultValue: false);
const bool isTest = const bool isTest = bool.fromEnvironment('ENV', defaultValue: false);
bool.fromEnvironment('dart.vm.environment', defaultValue: false);
if (isProduction) { if (isProduction) {
return '.env.production'; return '.env.production';
@ -29,3 +31,8 @@ class Environment {
return dotenv.env['ENV'] ?? 'ENV not found!'; return dotenv.env['ENV'] ?? 'ENV not found!';
} }
} }
Future<void> main() async {
await dotenv.load(fileName: Environment.fileName);
runApp(MyApp());
}