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.
1 line
6.8 KiB
Dart
1 line
6.8 KiB
Dart
import 'package:driverapp/config/config.dart';
|
|
import 'package:driverapp/core/viewModels/orders_view_model.dart';
|
|
import 'package:driverapp/pages/base/base_view.dart';
|
|
import 'package:driverapp/root_page.dart';
|
|
import 'package:driverapp/uitl/utils.dart';
|
|
import 'package:driverapp/widgets/buttons/secondary_button.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:location/location.dart';
|
|
|
|
import '../../widgets/others/app_scaffold_widget.dart';
|
|
|
|
class RequestPermissionPage extends StatelessWidget {
|
|
RequestPermissionPage();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<OrdersViewModel>(
|
|
builder: (_, model, w) => AppScaffold(
|
|
isShowAppBar: true,
|
|
appBarColor: Color(0xff49C1BC),
|
|
arrowColor: Colors.white,
|
|
titleColor: Colors.white,
|
|
appBarTitle: "Request Permissions",
|
|
isAppBarGradient: true,
|
|
body: Container(
|
|
child: Container(
|
|
decoration: BoxDecoration(gradient: LINEAR_GRADIENT),
|
|
child: ListView(
|
|
children: <Widget>[
|
|
Column(
|
|
children: <Widget>[
|
|
Stack(
|
|
children: <Widget>[
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 75.0),
|
|
child: Container(
|
|
width: MediaQuery.of(context).size.width * 1.0,
|
|
height: MediaQuery.of(context).orientation ==
|
|
Orientation.portrait
|
|
? MediaQuery.of(context).size.height * 0.70
|
|
: MediaQuery.of(context).size.height * 1.7,
|
|
margin: EdgeInsets.only(
|
|
top: MediaQuery.of(context).orientation ==
|
|
Orientation.portrait
|
|
? MediaQuery.of(context).size.width * 0.23
|
|
: MediaQuery.of(context).size.width * 0.13),
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).scaffoldBackgroundColor,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(45),
|
|
topRight: Radius.circular(45)),
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: MediaQuery.of(context).orientation ==
|
|
Orientation.portrait
|
|
? MediaQuery.of(context).size.height *
|
|
0.05
|
|
: MediaQuery.of(context).size.height *
|
|
0.29,
|
|
//MediaQuery.of(context).size.width * 0.005,
|
|
),
|
|
Padding(
|
|
padding: MediaQuery.of(context).orientation ==
|
|
Orientation.portrait
|
|
? EdgeInsets.only(top: 60.0)
|
|
: EdgeInsets.only(top: 15.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Text(
|
|
"Delivery app need permission to your location information")
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height:
|
|
MediaQuery.of(context).size.width * 0.08,
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: MediaQuery.of(context).size.width *
|
|
0.05,
|
|
right: MediaQuery.of(context).size.width *
|
|
0.05,
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height:
|
|
MediaQuery.of(context).size.width * 0.1,
|
|
),
|
|
Container(
|
|
margin: MediaQuery.of(context).orientation ==
|
|
Orientation.portrait
|
|
? EdgeInsets.all(8.0)
|
|
: EdgeInsets.symmetric(horizontal: 12.0),
|
|
child: SecondaryButton(
|
|
label: "request permission",
|
|
onTap: () async {
|
|
LocationData loc =
|
|
await Utils.getLocation();
|
|
if (loc != null) {
|
|
Navigator.pushReplacement(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => RootPage(),
|
|
),
|
|
);
|
|
}
|
|
// Location location = new Location();
|
|
// await location.requestPermission();
|
|
// Utils.getLocationPermission()
|
|
// .then((value) {
|
|
// if (value == PermissionStatus.granted) {
|
|
//
|
|
// }
|
|
// });
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|