You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
driver-app/lib/pages/splash_screen_page.dart

203 lines
7.5 KiB
Dart

import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:driverapp/root_page.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../locator.dart';
class SplashScreenPage extends StatefulWidget {
@override
_SplashScreenPageState createState() => _SplashScreenPageState();
}
class _SplashScreenPageState extends State<SplashScreenPage> {
OrdersViewModel _ordersViewModel = locator<OrdersViewModel>();
startTime() async {
await _ordersViewModel.getOrdersStatus();
navigationPage();
}
@override
void initState() {
super.initState();
startTime();
}
//
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: false,
appBarColor: Color(0xff30B7B9),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment(1.0, 0.0),
end: Alignment(
-0.0, 0.0), // 10% of the width, so there are ten blinds.
colors: [
const Color(0xFF1BB0B8),
const Color(0xFF44BFBB)
], //[const Color(0xff30B7B9), const Color(0xff3AB2AD)], // whitish to gray
tileMode: TileMode.clamp, // repeats the gradient over the canvas
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.89,
child: Column(
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? 200
: 50,
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
DriverApp.logo,
size: MediaQuery.of(context).orientation ==
Orientation.portrait
? 120
: 70,
color: Colors.white,
),
margin: EdgeInsets.only(
right: projectViewModel.isArabic
? 0
: MediaQuery.of(context).size.width * 0.20,
left: !projectViewModel.isArabic
? MediaQuery.of(context).orientation ==
Orientation.landscape
? MediaQuery.of(context).size.width * 0.13
: MediaQuery.of(context).size.width * 0.0
: MediaQuery.of(context).size.width * 0.10),
),
],
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? 20
: 15,
),
Column(
children: <Widget>[
Text(
"Driver",
style: TextStyle(
fontSize: MediaQuery.of(context).orientation ==
Orientation.portrait
? 70
: 35,
fontWeight: FontWeight.bold,
color: Colors.white),
),
Text(
"Delivery",
style: TextStyle(
fontSize: MediaQuery.of(context).orientation ==
Orientation.portrait
? 50
: 25,
letterSpacing: 1,
color: Colors.white),
),
Text(
"APP",
style: TextStyle(
fontSize: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? 53
: 21,
letterSpacing:
MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? 53
: 27,
color: Colors.white,
fontWeight: FontWeight.w400),
),
],
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? 100
: 50,
)
],
),
),
Center(
child: FractionallySizedBox(
widthFactor: 0.80,
child: Column(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Expanded(
child: Center(
child: Text(
"Powered by Cloud Solutions",
style: TextStyle(
fontSize: 13, color: Colors.white),
),
),
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? 10
: 5,
)
],
),
),
],
),
],
),
),
),
],
),
),
),
);
}
void navigationPage() {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => RootPage(),
),
);
}
}