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,7 +452,14 @@ class _hrDashboardState extends State<hrDashboard> {
), ),
), ),
SizedBox(height: 8), SizedBox(height: 8),
Row( SingleChildScrollView(
scrollDirection:
Axis.horizontal,
controller:
ScrollController(), // Adding ScrollController
dragStartBehavior:
DragStartBehavior.start,
child: Row(
children: List.generate( children: List.generate(
policyDetails.length, policyDetails.length,
(index) => Container( (index) => Container(
@ -482,8 +490,10 @@ class _hrDashboardState extends State<hrDashboard> {
ListTile( ListTile(
title: title:
SizedBox( SizedBox(
height: 50, height:
child: Text( 50,
child:
Text(
'${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})', '${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})',
style: GoogleFonts style: GoogleFonts
.poppins( .poppins(
@ -491,8 +501,8 @@ class _hrDashboardState extends State<hrDashboard> {
16, 16,
fontWeight: fontWeight:
FontWeight.w500, FontWeight.w500,
color: Color( color:
0xFF000000), Color(0xFF000000),
height: height:
1.5, 1.5,
), ),
@ -502,10 +512,10 @@ class _hrDashboardState extends State<hrDashboard> {
), ),
), ),
SizedBox( SizedBox(
height: 8), height:
8),
Padding( Padding(
padding: EdgeInsets padding: EdgeInsets.only(
.only(
left: left:
15, 15,
right: right:
@ -513,7 +523,8 @@ class _hrDashboardState extends State<hrDashboard> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
flex: 4, flex:
4,
child: child:
Column( Column(
crossAxisAlignment: crossAxisAlignment:
@ -541,7 +552,8 @@ class _hrDashboardState extends State<hrDashboard> {
), ),
), ),
Expanded( Expanded(
flex: 4, flex:
4,
child: child:
Column( Column(
crossAxisAlignment: crossAxisAlignment:
@ -569,7 +581,8 @@ class _hrDashboardState extends State<hrDashboard> {
), ),
), ),
Expanded( Expanded(
flex: 4, flex:
4,
child: child:
Column( Column(
crossAxisAlignment: crossAxisAlignment:
@ -607,6 +620,7 @@ class _hrDashboardState extends State<hrDashboard> {
), ),
), ),
), ),
),
SizedBox(height: 20), SizedBox(height: 20),
], ],
); );

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());
}