"git@183.82.99.133:saisrinivas/gen_rentals.git" did not exist on "eecc769fa9e738c5060e3892507a2f14526cd7fe"
Commit a3882747 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

First commit after setup

parent a2b314a9
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Gen Rentals</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>gen_rentals</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
#import "GeneratedPluginRegistrant.h"
import Flutter
import UIKit
import XCTest
class RunnerTests: XCTestCase {
func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}
}
class CommonResponse {
int? error;
int? balance;
String? message;
CommonResponse({this.error, this.balance, this.message});
CommonResponse.fromJson(Map<String, dynamic> json) {
error = json['error'];
balance = json['balance'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['balance'] = this.balance;
data['message'] = this.message;
return data;
}
}
class RentalPaymentDetailsResponse {
List<Bill>? bill;
int? error;
String? message;
RentalPaymentDetailsResponse({this.bill, this.error, this.message});
RentalPaymentDetailsResponse.fromJson(Map<String, dynamic> json) {
if (json['bill'] != null) {
bill = <Bill>[];
json['bill'].forEach((v) {
bill!.add(new Bill.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.bill != null) {
data['bill'] = this.bill!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Bill {
String? narration;
String? amount;
String? mode;
String? ref;
String? datetime;
Bill({this.narration, this.amount, this.mode, this.ref, this.datetime});
Bill.fromJson(Map<String, dynamic> json) {
narration = json['narration'];
amount = json['amount'];
mode = json['mode'];
ref = json['ref'];
datetime = json['datetime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['narration'] = this.narration;
data['amount'] = this.amount;
data['mode'] = this.mode;
data['ref'] = this.ref;
data['datetime'] = this.datetime;
return data;
}
}
class TicketChatDisplayResponse {
List<Ticket>? ticket;
int? error;
String? message;
TicketChatDisplayResponse({this.ticket, this.error, this.message});
TicketChatDisplayResponse.fromJson(Map<String, dynamic> json) {
if (json['ticket'] != null) {
ticket = <Ticket>[];
json['ticket'].forEach((v) {
ticket!.add(new Ticket.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.ticket != null) {
data['ticket'] = this.ticket!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Ticket {
String? tid;
String? datetime;
String? msg;
String? type;
Ticket({this.tid, this.datetime, this.msg, this.type});
Ticket.fromJson(Map<String, dynamic> json) {
tid = json['tid'];
datetime = json['datetime'];
msg = json['msg'];
type = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['tid'] = this.tid;
data['datetime'] = this.datetime;
data['msg'] = this.msg;
data['type'] = this.type;
return data;
}
}
class BillListResponse {
List<Bills>? bills;
int? error;
String? message;
BillListResponse({this.bills, this.error, this.message});
BillListResponse.fromJson(Map<String, dynamic> json) {
if (json['bills'] != null) {
bills = <Bills>[];
json['bills'].forEach((v) {
bills!.add(new Bills.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.bills != null) {
data['bills'] = this.bills!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Bills {
String? datetime;
String? billNarration;
String? totalAmount;
String? billId;
String? type;
Bills(
{this.datetime,
this.billNarration,
this.totalAmount,
this.billId,
this.type});
Bills.fromJson(Map<String, dynamic> json) {
datetime = json['datetime'];
billNarration = json['bill_narration'];
totalAmount = json['total_amount'];
billId = json['bill_id'];
type = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['datetime'] = this.datetime;
data['bill_narration'] = this.billNarration;
data['total_amount'] = this.totalAmount;
data['bill_id'] = this.billId;
data['type'] = this.type;
return data;
}
}
class BillProductResponse {
List<Bp>? bp;
int? error;
String? message;
BillProductResponse({this.bp, this.error, this.message});
BillProductResponse.fromJson(Map<String, dynamic> json) {
if (json['bp'] != null) {
bp = <Bp>[];
json['bp'].forEach((v) {
bp!.add(new Bp.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.bp != null) {
data['bp'] = this.bp!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Bp {
String? pname;
String? qty;
String? totalAmount;
Bp({this.pname, this.qty, this.totalAmount});
Bp.fromJson(Map<String, dynamic> json) {
pname = json['pname'];
qty = json['qty'];
totalAmount = json['total_amount'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['pname'] = this.pname;
data['qty'] = this.qty;
data['total_amount'] = this.totalAmount;
return data;
}
}
class OrderDetailsBillResponse {
List<Bill>? bill;
int? error;
String? message;
OrderDetailsBillResponse({this.bill, this.error, this.message});
OrderDetailsBillResponse.fromJson(Map<String, dynamic> json) {
if (json['bill'] != null) {
bill = <Bill>[];
json['bill'].forEach((v) {
bill!.add(new Bill.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.bill != null) {
data['bill'] = this.bill!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Bill {
String? totalAmount;
String? datetime;
String? billNarration;
String? billId;
Bill({this.totalAmount, this.datetime, this.billNarration, this.billId});
Bill.fromJson(Map<String, dynamic> json) {
totalAmount = json['total_amount'];
datetime = json['datetime'];
billNarration = json['bill_narration'];
billId = json['bill_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['total_amount'] = this.totalAmount;
data['datetime'] = this.datetime;
data['bill_narration'] = this.billNarration;
data['bill_id'] = this.billId;
return data;
}
}
class OrderDetailsMainResponse {
List<Bill>? bill;
int? error;
String? message;
OrderDetailsMainResponse({this.bill, this.error, this.message});
OrderDetailsMainResponse.fromJson(Map<String, dynamic> json) {
if (json['bill'] != null) {
bill = <Bill>[];
json['bill'].forEach((v) {
bill!.add(new Bill.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.bill != null) {
data['bill'] = this.bill!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Bill {
String? dispAddress;
String? tenure;
Bill({this.dispAddress, this.tenure});
Bill.fromJson(Map<String, dynamic> json) {
dispAddress = json['disp_address'];
tenure = json['tenure'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['disp_address'] = this.dispAddress;
data['tenure'] = this.tenure;
return data;
}
}
class OrderDetailsProductResponse {
List<Products>? products;
int? error;
String? message;
OrderDetailsProductResponse({this.products, this.error, this.message});
OrderDetailsProductResponse.fromJson(Map<String, dynamic> json) {
if (json['products'] != null) {
products = <Products>[];
json['products'].forEach((v) {
products!.add(new Products.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.products != null) {
data['products'] = this.products!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Products {
String? pname;
String? qty;
String? totalAmount;
String? type;
Products({this.pname, this.qty, this.totalAmount, this.type});
Products.fromJson(Map<String, dynamic> json) {
pname = json['pname'];
qty = json['qty'];
totalAmount = json['total_amount'];
type = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['pname'] = this.pname;
data['qty'] = this.qty;
data['total_amount'] = this.totalAmount;
data['type'] = this.type;
return data;
}
}
class OrderListResponse {
List<Order>? order;
int? error;
String? message;
OrderListResponse({this.order, this.error, this.message});
OrderListResponse.fromJson(Map<String, dynamic> json) {
if (json['order'] != null) {
order = <Order>[];
json['order'].forEach((v) {
order!.add(new Order.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.order != null) {
data['order'] = this.order!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Order {
String? orderid;
String? datetime;
String? address;
Order({this.orderid, this.datetime, this.address});
Order.fromJson(Map<String, dynamic> json) {
orderid = json['orderid'];
datetime = json['datetime'];
address = json['address'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['orderid'] = this.orderid;
data['datetime'] = this.datetime;
data['address'] = this.address;
return data;
}
}
class RentalAccountResponse {
List<Account>? account;
int? error;
String? message;
RentalAccountResponse({this.account, this.error, this.message});
RentalAccountResponse.fromJson(Map<String, dynamic> json) {
if (json['account'] != null) {
account = <Account>[];
json['account'].forEach((v) {
account!.add(new Account.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.account != null) {
data['account'] = this.account!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Account {
String? id;
String? name;
String? address;
Account({this.id, this.name, this.address});
Account.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
address = json['address'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['address'] = this.address;
return data;
}
}
class RentalContactResponse {
int? error;
String? message;
int? exist;
String? city;
String? raname;
String? mob;
String? mail;
String? address;
String? state;
String? accId;
int? otp;
RentalContactResponse(
{this.error,
this.message,
this.exist,
this.city,
this.raname,
this.mob,
this.mail,
this.address,
this.state,
this.accId,
this.otp});
RentalContactResponse.fromJson(Map<String, dynamic> json) {
error = json['error'];
message = json['message'];
exist = json['exist'];
city = json['city'];
raname = json['raname'];
mob = json['mob'];
mail = json['mail'];
address = json['address'];
state = json['state'];
accId = json['acc_id'];
otp = json['otp'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
data['exist'] = this.exist;
data['city'] = this.city;
data['raname'] = this.raname;
data['mob'] = this.mob;
data['mail'] = this.mail;
data['address'] = this.address;
data['state'] = this.state;
data['acc_id'] = this.accId;
data['otp'] = this.otp;
return data;
}
}
class TicketListResponse {
List<Ticket>? ticket;
int? error;
String? message;
TicketListResponse({this.ticket, this.error, this.message});
TicketListResponse.fromJson(Map<String, dynamic> json) {
if (json['ticket'] != null) {
ticket = <Ticket>[];
json['ticket'].forEach((v) {
ticket!.add(new Ticket.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.ticket != null) {
data['ticket'] = this.ticket!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class Ticket {
String? tid;
String? datetime;
String? status;
String? subject;
Ticket({this.tid, this.datetime, this.status, this.subject});
Ticket.fromJson(Map<String, dynamic> json) {
tid = json['tid'];
datetime = json['datetime'];
status = json['status'];
subject = json['subject'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['tid'] = this.tid;
data['datetime'] = this.datetime;
data['status'] = this.status;
data['subject'] = this.subject;
return data;
}
}
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../Models/rentalContactResponse.dart';
import '../Services/api_calling.dart';
class RentalContactProvider extends ChangeNotifier {
bool _isLoading = false;
RentalContactResponse? _rentalContact;
String? _errorMessage;
// Getters
bool get isLoading => _isLoading;
RentalContactResponse? get rentalContact => _rentalContact;
String? get errorMessage => _errorMessage;
/// Call API and fetch rental contact
Future<void> fetchRentalContactData(
BuildContext context,
String sessionId,
String empId,
String mob,
) async {
try {
_isLoading = true;
_errorMessage = null;
notifyListeners();
final data =
await ApiCalling.fetchRentalContactApi(sessionId, empId, mob);
debugPrint("############################### provider called!");
if (data != null) {
_rentalContact = data;
debugPrint(" Rental Contact fetched: ${data.toJson()}");
if (data.error == 0) {
// success
// toast(context, "Rental Contact fetched successfully");
} else {
// API returned error
_errorMessage = data.message ?? "Unknown error";
// toast(context, _errorMessage!);
}
} else {
_errorMessage = "No response from server";
// toast(context, _errorMessage!);
}
} catch (e) {
_errorMessage = "❌ Exception: $e";
debugPrint(_errorMessage);
// toast(context, "Something went wrong");
} finally {
_isLoading = false;
notifyListeners();
}
}
/// Reset state if needed
void reset() {
_rentalContact = null;
_errorMessage = null;
_isLoading = false;
notifyListeners();
}
}
class BillDetailsResponse {
List<BillDetails>? billDetails;
int? error;
String? message;
BillDetailsResponse({this.billDetails, this.error, this.message});
BillDetailsResponse.fromJson(Map<String, dynamic> json) {
if (json['bill_details'] != null) {
billDetails = <BillDetails>[];
json['bill_details'].forEach((v) {
billDetails!.add(new BillDetails.fromJson(v));
});
}
error = json['error'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.billDetails != null) {
data['bill_details'] = this.billDetails!.map((v) => v.toJson()).toList();
}
data['error'] = this.error;
data['message'] = this.message;
return data;
}
}
class BillDetails {
String? totalAmount;
String? raisedOn;
String? billNarration;
String? billId;
String? orderId;
BillDetails(
{this.totalAmount,
this.raisedOn,
this.billNarration,
this.billId,
this.orderId});
BillDetails.fromJson(Map<String, dynamic> json) {
totalAmount = json['total_amount'];
raisedOn = json['raised_on'];
billNarration = json['bill_narration'];
billId = json['bill_id'];
orderId = json['order_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['total_amount'] = this.totalAmount;
data['raised_on'] = this.raisedOn;
data['bill_narration'] = this.billNarration;
data['bill_id'] = this.billId;
data['order_id'] = this.orderId;
return data;
}
}
import 'package:flutter/material.dart';
class ThemeProvider extends ChangeNotifier {
bool _isDark = false;
bool get isDark => _isDark;
void toggleTheme() {
_isDark = !_isDark;
notifyListeners();
}
}
// In your widget or screen
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../Utility/AdvancedSnackbar.dart';
import '../Utility/AppColors.dart';
import '../Utility/CustomSnackbar.dart';
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Snackbar Demo')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Simple usage
ElevatedButton(
onPressed: () {
CustomSnackBar.showSuccess(
context: context,
title: "Payment Successful",
message: "Your payment of \$99.99 has been processed successfully.",
action: SnackBarAction(
label: "VIEW RECEIPT",
onPressed: () {
// Handle action
},
),
);
},
child: Text('Show Success'),
),
ElevatedButton(
onPressed: () {
CustomSnackBar.showError(
context: context,
message: "Network connection lost. Please check your internet.",
action: SnackBarAction(
label: "RETRY",
onPressed: () {
// Retry logic
},
),
);
},
child: Text('Show Error with Action'),
),
// Advanced usage
ElevatedButton(
onPressed: () {
AnimatedSnackBar.success(
context: context,
title: "Payment Successful",
message: "Your order has been processed successfully!",
);
},
child: Text('Show Advanced Snackbar'),
),
// Custom snackbar
ElevatedButton(
onPressed: () {
CustomSnackBar.showError(
context: context,
message: "Network connection lost. Please check your internet.",
action: SnackBarAction(
label: "RETRY",
onPressed: () {
// Retry logic
},
),
);
},
child: Text('Show Custom Snackbar'),
),
],
),
),
);
}
}
\ No newline at end of file
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import '../Utility/CustomSnackbar.dart';
import 'authScreen/LoginScreen.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _fadeAnimation;
late Animation<double> _scaleAnimation;
late Animation<Offset> _slideAnimation;
late Animation<double> _rotationAnimation;
Timer? _connectivityTimer;
bool _progressCheckCompleted = false;
bool _hasInternet = true;
@override
void initState() {
super.initState();
// Initialize connectivity check
_initConnectivity();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 1500),
);
// Multiple animations
_fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.0, 0.6, curve: Curves.easeInOut),
),
);
_scaleAnimation = Tween<double>(begin: 0.5, end: 1.0).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.2, 0.8, curve: Curves.elasticOut),
),
);
_slideAnimation = Tween<Offset>(
begin: const Offset(0, 0.5),
end: Offset.zero,
).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.3, 0.8, curve: Curves.easeOutCubic),
),
);
_rotationAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
parent: _controller,
curve: const Interval(0.0, 0.4, curve: Curves.easeInOut),
),
);
// Start animations
_controller.forward();
// Navigate after delay
Timer(const Duration(seconds: 3), () {
Navigator.pushReplacement(
context,
PageRouteBuilder(
pageBuilder: (_, __, ___) => const LoginScreen(),
transitionsBuilder: (_, animation, __, child) {
return FadeTransition(
opacity: animation,
child: child,
);
},
transitionDuration: const Duration(milliseconds: 800),
),
);
});
}
Future<void> _initConnectivity() async {
try {
// Initial connectivity check
await _checkConnectivity();
// Use periodic checks instead of stream
_connectivityTimer = Timer.periodic(const Duration(seconds: 3), (timer) {
_checkConnectivity();
});
} catch (e) {
debugPrint("Connectivity initialization error: $e");
_updateConnectionStatus(false);
}
}
Future<void> _checkConnectivity() async {
try {
// Method 1: Using connectivity_plus
final connectivity = Connectivity();
final results = await connectivity.checkConnectivity();
final hasInternet = results.any((result) => result != ConnectivityResult.none);
// Method 2: Fallback with socket test
if (hasInternet) {
try {
final result = await InternetAddress.lookup('google.com');
final socketCheck = result.isNotEmpty && result[0].rawAddress.isNotEmpty;
_updateConnectionStatus(socketCheck);
} catch (e) {
_updateConnectionStatus(false);
}
} else {
_updateConnectionStatus(false);
}
} catch (e) {
debugPrint("Connectivity check error: $e");
_updateConnectionStatus(false);
}
}
void _updateConnectionStatus(bool hasInternet) {
if (mounted) {
setState(() {
_hasInternet = hasInternet;
});
}
if (!hasInternet) {
_showNoInternetSnackbar();
} else {
// Dismiss the warning snackbar if internet is restored
ScaffoldMessenger.of(context).hideCurrentSnackBar();
// if (!_progressCheckCompleted) {
// _startLoginCheck();
// }
}
}
void _showNoInternetSnackbar() {
if (mounted) {
WidgetsBinding.instance.addPostFrameCallback((_) {
// Hide any existing snackbar
ScaffoldMessenger.of(context).hideCurrentSnackBar();
CustomSnackBar.showError(
context: context,
message: "No internet connection! Please connect to the internet.",
action: SnackBarAction(
label: "RETRY",
onPressed: () {
// Retry logic
},
),
);
});
}
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF5F8FC),
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFFF5F8FC),
Color(0xFFE3F2FD),
Color(0xFFB3E5FC),
],
stops: [0.0, 0.6, 1.0],
),
),
child: Stack(
children: [
// Animated background elements
Positioned(
top: -50,
right: -50,
child: AnimatedBuilder(
animation: _rotationAnimation,
builder: (context, child) {
return Transform.rotate(
angle: _rotationAnimation.value * 2 * 3.14159,
child: Container(
width: 200,
height: 200,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: const Color(0xFF26BAE7).withOpacity(0.1),
),
),
);
},
),
),
Positioned(
bottom: -30,
left: -30,
child: AnimatedBuilder(
animation: _rotationAnimation,
builder: (context, child) {
return Transform.rotate(
angle: -_rotationAnimation.value * 2 * 3.14159,
child: Container(
width: 150,
height: 150,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: const Color(0xFF26BAE7).withOpacity(0.08),
),
),
);
},
),
),
// Main content
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Logo with multiple animations
AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Transform.translate(
offset: _slideAnimation.value * 100,
child: Transform.scale(
scale: _scaleAnimation.value,
child: Opacity(
opacity: _fadeAnimation.value,
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFF26BAE7).withOpacity(0.3),
blurRadius: 20,
spreadRadius: 2,
offset: const Offset(0, 5),
),
],
),
child: RotationTransition(
turns: _rotationAnimation,
child: SvgPicture.network(
"https://genrentals.in/assets/img/logo-black.svg",
height: 80,
),
),
),
),
),
);
},
),
const SizedBox(height: 30),
// App name with animation
AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Transform.translate(
offset: _slideAnimation.value * 50,
child: Opacity(
opacity: _fadeAnimation.value,
child: Transform.scale(
scale: _scaleAnimation.value,
child: const Text(
"Gen Rentals",
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.w800,
color: Color(0xFF26BAE7),
letterSpacing: 1.2,
),
),
),
),
);
},
),
const SizedBox(height: 10),
// Tagline with animation
AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Opacity(
opacity: _fadeAnimation.value,
child: Transform.translate(
offset: _slideAnimation.value * 30,
child: const Text(
"Premium Equipment Rentals",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF666666),
letterSpacing: 0.5,
),
),
),
);
},
),
const SizedBox(height: 50),
// Loading indicator
AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Opacity(
opacity: _fadeAnimation.value,
child: Container(
width: 100,
height: 3,
decoration: BoxDecoration(
color: const Color(0xFF26BAE7).withOpacity(0.3),
borderRadius: BorderRadius.circular(2),
),
child: Stack(
children: [
// Animated progress bar
AnimatedContainer(
duration: const Duration(milliseconds: 3000),
width: 100 * _controller.value,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [
Color(0xFF26BAE7),
Color(0xFF4FC3F7),
],
),
borderRadius: BorderRadius.circular(2),
),
),
],
),
),
);
},
),
],
),
),
// Bottom wave decoration
Positioned(
bottom: 0,
left: 0,
right: 0,
child: AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Transform.translate(
offset: Offset(0, 20 * (1 - _controller.value)),
child: Opacity(
opacity: _fadeAnimation.value,
child: CustomPaint(
size: Size(MediaQuery.of(context).size.width, 80),
painter: WavePainter(),
),
),
);
},
),
),
],
),
),
);
}
}
// Custom wave painter for bottom decoration
class WavePainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
..color = const Color(0xFF26BAE7).withOpacity(0.1)
..style = PaintingStyle.fill;
final path = Path();
path.moveTo(0, size.height * 0.5);
path.quadraticBezierTo(
size.width * 0.25, size.height * 0.3,
size.width * 0.5, size.height * 0.5,
);
path.quadraticBezierTo(
size.width * 0.75, size.height * 0.7,
size.width, size.height * 0.5,
);
path.lineTo(size.width, size.height);
path.lineTo(0, size.height);
path.close();
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment