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
cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file
if ! grep -q BASE_HREF .env; then
echo "BASE_HREF not found in .env file"
exit 1
fi
# Verify .env file contains correct values
source .env
# 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
echo "BASE_HREF value is empty"
exit 1
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
flutter build web --release --base-href "$BASE_HREF"
# Optionally, remove the .env file after the build
# rm .env
# Check if the build was successful
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
# Define the path to the .env file for production
# Define the path to the .env.production file
ENV_FILE_PATH=".env.production"
# Check if the .env file exists
# Check if the .env.production file exists
if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist"
exit 1
fi
# Copy the .env file for production to .env
# Copy the .env.production file to .env
cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file
if ! grep -q BASE_HREF .env; then
echo "BASE_HREF not found in .env file"
exit 1
fi
# Verify .env file contains correct values
source .env
# 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
echo "BASE_HREF value is empty"
exit 1
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"
# Optionally, remove the .env file after the build
# rm .env
# Check if the build was successful
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
# Define the path to the .env file for testing
# Define the path to the .env.test file
ENV_FILE_PATH=".env.test"
# Check if the .env file exists
# Check if the .env.test file exists
if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist"
exit 1
fi
# Copy the .env file for testing to .env
# Copy the .env.test file to .env
cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file
if ! grep -q BASE_HREF .env; then
echo "BASE_HREF not found in .env file"
exit 1
fi
# Verify .env file contains correct values
source .env
# 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
echo "BASE_HREF value is empty"
exit 1
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"
# Optionally, remove the .env file after the build
# rm .env
# Check if the build was successful
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 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:google_fonts/google_fonts.dart';
@ -451,7 +452,14 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
SizedBox(height: 8),
Row(
SingleChildScrollView(
scrollDirection:
Axis.horizontal,
controller:
ScrollController(), // Adding ScrollController
dragStartBehavior:
DragStartBehavior.start,
child: Row(
children: List.generate(
policyDetails.length,
(index) => Container(
@ -482,8 +490,10 @@ class _hrDashboardState extends State<hrDashboard> {
ListTile(
title:
SizedBox(
height: 50,
child: Text(
height:
50,
child:
Text(
'${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})',
style: GoogleFonts
.poppins(
@ -491,8 +501,8 @@ class _hrDashboardState extends State<hrDashboard> {
16,
fontWeight:
FontWeight.w500,
color: Color(
0xFF000000),
color:
Color(0xFF000000),
height:
1.5,
),
@ -502,10 +512,10 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
SizedBox(
height: 8),
height:
8),
Padding(
padding: EdgeInsets
.only(
padding: EdgeInsets.only(
left:
15,
right:
@ -513,7 +523,8 @@ class _hrDashboardState extends State<hrDashboard> {
child: Row(
children: [
Expanded(
flex: 4,
flex:
4,
child:
Column(
crossAxisAlignment:
@ -541,7 +552,8 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
Expanded(
flex: 4,
flex:
4,
child:
Column(
crossAxisAlignment:
@ -569,7 +581,8 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
Expanded(
flex: 4,
flex:
4,
child:
Column(
crossAxisAlignment:
@ -607,6 +620,7 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
),
),
SizedBox(height: 20),
],
);

View File

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