fix: fixing laoyout in login screen
This commit is contained in:
parent
ce514d0a27
commit
b988933413
|
|
@ -1,4 +1,6 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<application
|
<application
|
||||||
android:label="Rijig"
|
android:label="Rijig"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import 'package:rijig_mobile/core/utils/exportimportview.dart';
|
import 'package:rijig_mobile/core/utils/exportimportview.dart';
|
||||||
import 'package:rijig_mobile/features/home/presentation/screen/collector/pickup_history_screen.dart';
|
|
||||||
import 'package:rijig_mobile/features/pickup/presentation/screen/pickup_map_screen.dart';
|
|
||||||
|
|
||||||
final router = GoRouter(
|
final router = GoRouter(
|
||||||
routes: [
|
routes: [
|
||||||
// GoRoute(path: '/', builder: (context, state) => SplashScreen()),
|
GoRoute(path: '/', builder: (context, state) => SplashScreen()),
|
||||||
GoRoute(path: '/', builder: (context, state) => CollectorRouteMapScreen()),
|
GoRoute(path: '/cmapview', builder: (context, state) => CollectorRouteMapScreen()),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/onboarding',
|
path: '/onboarding',
|
||||||
builder: (context, state) => OnboardingPageScreen(),
|
builder: (context, state) => OnboardingPageScreen(),
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,10 @@ export 'package:rijig_mobile/features/home/presentation/components/about_detail_
|
||||||
export 'package:rijig_mobile/features/home/presentation/components/article_content.dart';
|
export 'package:rijig_mobile/features/home/presentation/components/article_content.dart';
|
||||||
export 'package:rijig_mobile/features/pickup/presentation/screen/pickup_screen.dart';
|
export 'package:rijig_mobile/features/pickup/presentation/screen/pickup_screen.dart';
|
||||||
export 'package:rijig_mobile/features/pickup/presentation/screen/selectcollector_screen.dart';
|
export 'package:rijig_mobile/features/pickup/presentation/screen/selectcollector_screen.dart';
|
||||||
export 'package:rijig_mobile/features/auth/presentation/screen/collector/clogin_screen.dart';
|
|
||||||
export 'package:rijig_mobile/features/auth/presentation/screen/collector/identity_validation_screen.dart';
|
export 'package:rijig_mobile/features/auth/presentation/screen/collector/identity_validation_screen.dart';
|
||||||
export 'package:rijig_mobile/features/auth/presentation/screen/collector/welcome_collector_screen.dart';
|
export 'package:rijig_mobile/features/auth/presentation/screen/collector/welcome_collector_screen.dart';
|
||||||
export 'package:rijig_mobile/features/home/presentation/screen/collector/chome_screen.dart';
|
export 'package:rijig_mobile/features/home/presentation/screen/collector/chome_screen.dart';
|
||||||
export 'package:rijig_mobile/features/auth/presentation/screen/collector/cotp_screen.dart';
|
export 'package:rijig_mobile/features/auth/presentation/screen/collector/cotp_screen.dart';
|
||||||
|
export 'package:rijig_mobile/features/auth/presentation/screen/collector/clogin_screen.dart';
|
||||||
|
export 'package:rijig_mobile/features/home/presentation/screen/collector/pickup_history_screen.dart';
|
||||||
|
export 'package:rijig_mobile/features/pickup/presentation/screen/pickup_map_screen.dart';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:gap/gap.dart';
|
|
||||||
import 'package:rijig_mobile/core/router.dart';
|
import 'package:rijig_mobile/core/router.dart';
|
||||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||||
import 'package:rijig_mobile/widget/buttoncard.dart';
|
import 'package:rijig_mobile/widget/buttoncard.dart';
|
||||||
|
|
@ -10,82 +9,112 @@ class CloginScreen extends StatefulWidget {
|
||||||
const CloginScreen({super.key});
|
const CloginScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CloginScreen> createState() => _CloginScreenState();
|
CloginScreenState createState() => CloginScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CloginScreenState extends State<CloginScreen> {
|
class CloginScreenState extends State<CloginScreen> {
|
||||||
final TextEditingController cPhoneController = TextEditingController();
|
final TextEditingController cPhoneController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
cPhoneController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final mediaQuery = MediaQuery.of(context);
|
final mediaQuery = MediaQuery.of(context);
|
||||||
return Scaffold(
|
|
||||||
body: SafeArea(
|
|
||||||
child: Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: PaddingCustom().paddingHorizontalVertical(15, 40),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Selamat datang di aplikasi",
|
|
||||||
style: Tulisan.subheading(),
|
|
||||||
),
|
|
||||||
Text("Rijig", style: Tulisan.heading(color: primaryColor)),
|
|
||||||
SizedBox(height: mediaQuery.size.height * 0.2),
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'assets/image/security.png',
|
|
||||||
width: mediaQuery.size.width * 0.35,
|
|
||||||
),
|
|
||||||
FormFieldOne(
|
|
||||||
controllers: cPhoneController,
|
|
||||||
hintText: 'Masukkan nomor whatsapp anda!',
|
|
||||||
placeholder: "cth.62..",
|
|
||||||
isRequired: true,
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
keyboardType: TextInputType.phone,
|
|
||||||
onTap: () {},
|
|
||||||
onChanged: (value) {},
|
|
||||||
fontSize: 14,
|
|
||||||
fontSizeField: 16,
|
|
||||||
onFieldSubmitted: (value) {},
|
|
||||||
readOnly: false,
|
|
||||||
enabled: true,
|
|
||||||
),
|
|
||||||
SizedBox(height: 20),
|
|
||||||
CardButtonOne(
|
|
||||||
textButton: "Kirim OTP",
|
|
||||||
fontSized: 16.sp,
|
|
||||||
colorText: whiteColor,
|
|
||||||
color: primaryColor,
|
|
||||||
borderRadius: 10,
|
|
||||||
horizontal: double.infinity,
|
|
||||||
vertical: 50,
|
|
||||||
onTap: () {
|
|
||||||
router.go('/cverif-otp');
|
|
||||||
},
|
|
||||||
|
|
||||||
usingRow: false,
|
return Scaffold(
|
||||||
),
|
resizeToAvoidBottomInset: true,
|
||||||
],
|
body: SafeArea(
|
||||||
),
|
child: SingleChildScrollView(
|
||||||
Gap(20),
|
padding: PaddingCustom().paddingHorizontalVertical(15, 40),
|
||||||
Row(
|
child: ConstrainedBox(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
constraints: BoxConstraints(
|
||||||
children: [
|
minHeight:
|
||||||
Text("kembali ke login sebagai:"),
|
mediaQuery.size.height * 1 / 4 -
|
||||||
TextButton(
|
mediaQuery.padding.top -
|
||||||
onPressed: () => router.go('/login'),
|
mediaQuery.padding.bottom,
|
||||||
child: Text("masyarakat?"),
|
),
|
||||||
),
|
child: IntrinsicHeight(
|
||||||
],
|
child: Column(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
],
|
children: [
|
||||||
),
|
Column(
|
||||||
],
|
children: [
|
||||||
|
Text(
|
||||||
|
"Selamat datang di aplikasi",
|
||||||
|
style: Tulisan.subheading(),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Rijig",
|
||||||
|
style: Tulisan.heading(color: primaryColor),
|
||||||
|
),
|
||||||
|
SizedBox(height: mediaQuery.size.height * 0.1),
|
||||||
|
Image.asset(
|
||||||
|
'assets/image/security.png',
|
||||||
|
width: mediaQuery.size.width * 0.35,
|
||||||
|
),
|
||||||
|
SizedBox(height: 30),
|
||||||
|
FormFieldOne(
|
||||||
|
controllers: cPhoneController,
|
||||||
|
hintText: 'Masukkan nomor whatsapp anda!',
|
||||||
|
placeholder: "cth.62..",
|
||||||
|
isRequired: true,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
keyboardType: TextInputType.phone,
|
||||||
|
onTap: () {},
|
||||||
|
onChanged: (value) {},
|
||||||
|
fontSize: 14,
|
||||||
|
fontSizeField: 16,
|
||||||
|
onFieldSubmitted: (value) {},
|
||||||
|
readOnly: false,
|
||||||
|
enabled: true,
|
||||||
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
CardButtonOne(
|
||||||
|
textButton: "kirim otp",
|
||||||
|
// viewModel.isLoading
|
||||||
|
// ? 'Sending OTP...'
|
||||||
|
// : 'Send OTP',
|
||||||
|
fontSized: 16.sp,
|
||||||
|
colorText: whiteColor,
|
||||||
|
color: primaryColor,
|
||||||
|
borderRadius: 10,
|
||||||
|
horizontal: double.infinity,
|
||||||
|
vertical: 50,
|
||||||
|
onTap: () {
|
||||||
|
// if (cPhoneController.text.isNotEmpty) {
|
||||||
|
// debugPrint("send otp dipencet");
|
||||||
|
// await viewModel.loginOrRegister(
|
||||||
|
// cPhoneController.text,
|
||||||
|
// );
|
||||||
|
// if (viewModel.loginResponse != null) {
|
||||||
|
// router.go(
|
||||||
|
// "/verif-otp",
|
||||||
|
// extra: cPhoneController.text,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
// loadingTrue: viewModel.isLoading,
|
||||||
|
usingRow: false,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text("login sebagai:"),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => router.push('/login'),
|
||||||
|
child: Text("masyarakat?"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gap/gap.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:rijig_mobile/core/router.dart';
|
import 'package:rijig_mobile/core/router.dart';
|
||||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||||
|
|
@ -15,103 +14,118 @@ class LoginScreen extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoginScreenState extends State<LoginScreen> {
|
class LoginScreenState extends State<LoginScreen> {
|
||||||
|
final TextEditingController phoneController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
phoneController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final mediaQuery = MediaQuery.of(context);
|
final mediaQuery = MediaQuery.of(context);
|
||||||
final TextEditingController phoneController = TextEditingController();
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
resizeToAvoidBottomInset: true,
|
||||||
body: Consumer<LoginViewModel>(
|
body: Consumer<LoginViewModel>(
|
||||||
builder: (context, viewModel, child) {
|
builder: (context, viewModel, child) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Center(
|
child: SingleChildScrollView(
|
||||||
child: Padding(
|
padding: PaddingCustom().paddingHorizontalVertical(15, 40),
|
||||||
padding: PaddingCustom().paddingHorizontalVertical(15, 40),
|
child: ConstrainedBox(
|
||||||
child: Column(
|
constraints: BoxConstraints(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
minHeight:
|
||||||
children: [
|
mediaQuery.size.height * 1 / 4 -
|
||||||
Column(
|
mediaQuery.padding.top -
|
||||||
children: [
|
mediaQuery.padding.bottom,
|
||||||
Text(
|
),
|
||||||
"Selamat datang di aplikasi",
|
child: IntrinsicHeight(
|
||||||
style: Tulisan.subheading(),
|
child: Column(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
Text(
|
children: [
|
||||||
"Rijig",
|
Column(
|
||||||
style: Tulisan.heading(color: primaryColor),
|
children: [
|
||||||
),
|
Text(
|
||||||
// Gap(60),
|
"Selamat datang di aplikasi",
|
||||||
SizedBox(height: mediaQuery.size.height * 0.2),
|
style: Tulisan.subheading(),
|
||||||
Column(
|
),
|
||||||
children: [
|
Text(
|
||||||
// Image.asset(
|
"Rijig",
|
||||||
// 'assets/image/security.png',
|
style: Tulisan.heading(color: primaryColor),
|
||||||
// width: mediaQuery.size.width * 0.35,
|
),
|
||||||
// ),
|
SizedBox(height: mediaQuery.size.height * 0.1),
|
||||||
FormFieldOne(
|
Image.asset(
|
||||||
controllers: phoneController,
|
'assets/image/security.png',
|
||||||
hintText: 'Masukkan nomor whatsapp anda!',
|
width: mediaQuery.size.width * 0.35,
|
||||||
placeholder: "cth.62..",
|
),
|
||||||
isRequired: true,
|
SizedBox(height: 30),
|
||||||
textInputAction: TextInputAction.done,
|
FormFieldOne(
|
||||||
keyboardType: TextInputType.phone,
|
controllers: phoneController,
|
||||||
onTap: () {},
|
hintText: 'Masukkan nomor whatsapp anda!',
|
||||||
onChanged: (value) {},
|
placeholder: "cth.62..",
|
||||||
fontSize: 14,
|
isRequired: true,
|
||||||
fontSizeField: 16,
|
textInputAction: TextInputAction.done,
|
||||||
onFieldSubmitted: (value) {},
|
keyboardType: TextInputType.phone,
|
||||||
readOnly: false,
|
onTap: () {},
|
||||||
enabled: true,
|
onChanged: (value) {},
|
||||||
),
|
fontSize: 14,
|
||||||
SizedBox(height: 20),
|
fontSizeField: 16,
|
||||||
CardButtonOne(
|
onFieldSubmitted: (value) {},
|
||||||
textButton:
|
readOnly: false,
|
||||||
viewModel.isLoading
|
enabled: true,
|
||||||
? 'Sending OTP...'
|
),
|
||||||
: 'Send OTP',
|
SizedBox(height: 20),
|
||||||
fontSized: 16,
|
CardButtonOne(
|
||||||
colorText: whiteColor,
|
textButton:
|
||||||
color: primaryColor,
|
viewModel.isLoading
|
||||||
borderRadius: 10,
|
? 'Sending OTP...'
|
||||||
horizontal: double.infinity,
|
: 'Send OTP',
|
||||||
vertical: 50,
|
fontSized: 16,
|
||||||
onTap: () async {
|
colorText: whiteColor,
|
||||||
if (phoneController.text.isNotEmpty) {
|
color: primaryColor,
|
||||||
debugPrint("send otp dipencet");
|
borderRadius: 10,
|
||||||
await viewModel.loginOrRegister(
|
horizontal: double.infinity,
|
||||||
phoneController.text,
|
vertical: 50,
|
||||||
|
onTap: () async {
|
||||||
|
if (phoneController.text.isNotEmpty) {
|
||||||
|
debugPrint("send otp dipencet");
|
||||||
|
await viewModel.loginOrRegister(
|
||||||
|
phoneController.text,
|
||||||
|
);
|
||||||
|
if (viewModel.loginResponse != null) {
|
||||||
|
router.go(
|
||||||
|
"/verif-otp",
|
||||||
|
extra: phoneController.text,
|
||||||
);
|
);
|
||||||
if (viewModel.loginResponse != null) {
|
|
||||||
router.go(
|
|
||||||
"/verif-otp",
|
|
||||||
extra: phoneController.text,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
loadingTrue: viewModel.isLoading,
|
},
|
||||||
usingRow: false,
|
loadingTrue: viewModel.isLoading,
|
||||||
),
|
usingRow: false,
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
Gap(20),
|
),
|
||||||
Row(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
Text("login sebagai:"),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
TextButton(
|
children: [
|
||||||
onPressed: () => router.push('/welcomec'),
|
Text("login sebagai:"),
|
||||||
child: Text("pengepul?"),
|
TextButton(
|
||||||
),
|
onPressed: () => router.push('/welcomec'),
|
||||||
],
|
child: Text("pengepul?"),
|
||||||
),
|
),
|
||||||
Gap(20),
|
],
|
||||||
TextButton(
|
),
|
||||||
onPressed: () => router.push('/navigasi'),
|
TextButton(
|
||||||
child: Text("skip login"),
|
onPressed: () => router.push('/navigasi'),
|
||||||
),
|
child: Text("skip login"),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
import 'package:rijig_mobile/widget/appbar.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:toastification/toastification.dart';
|
||||||
|
import 'package:geolocator/geolocator.dart';
|
||||||
|
|
||||||
class CollectorRouteMapScreen extends StatefulWidget {
|
class CollectorRouteMapScreen extends StatefulWidget {
|
||||||
const CollectorRouteMapScreen({super.key});
|
const CollectorRouteMapScreen({super.key});
|
||||||
|
|
@ -13,79 +16,141 @@ class CollectorRouteMapScreen extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CollectorRouteMapScreenState extends State<CollectorRouteMapScreen> {
|
class _CollectorRouteMapScreenState extends State<CollectorRouteMapScreen> {
|
||||||
final LatLng userLocation = LatLng(-7.250445, 112.768845);
|
LatLng? userLocation;
|
||||||
final LatLng collectorLocation = LatLng(-7.260445, 112.758845);
|
final LatLng collectorLocation = LatLng(-7.260445, 112.758845);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_initializeLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _initializeLocation() async {
|
||||||
|
final status = await Permission.location.request();
|
||||||
|
|
||||||
|
if (status.isGranted) {
|
||||||
|
try {
|
||||||
|
final LocationSettings locationSettings = LocationSettings(
|
||||||
|
accuracy: LocationAccuracy.high,
|
||||||
|
distanceFilter: 100,
|
||||||
|
);
|
||||||
|
|
||||||
|
Position position = await Geolocator.getCurrentPosition(
|
||||||
|
locationSettings: locationSettings,
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
userLocation = LatLng(position.latitude, position.longitude);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
toastification.show(
|
||||||
|
type: ToastificationType.error,
|
||||||
|
title: const Text("Gagal mendapatkan lokasi"),
|
||||||
|
description: Text(e.toString()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (status.isDenied) {
|
||||||
|
toastification.show(
|
||||||
|
type: ToastificationType.warning,
|
||||||
|
title: const Text("Izin lokasi ditolak sementara"),
|
||||||
|
autoCloseDuration: const Duration(seconds: 3),
|
||||||
|
);
|
||||||
|
} else if (status.isPermanentlyDenied) {
|
||||||
|
toastification.show(
|
||||||
|
type: ToastificationType.error,
|
||||||
|
title: const Text("Izin lokasi ditolak permanen"),
|
||||||
|
description: const Text(
|
||||||
|
"Buka pengaturan untuk mengaktifkan izin lokasi.",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> openMapWithGoogle(double latitude, double longitude) async {
|
Future<void> openMapWithGoogle(double latitude, double longitude) async {
|
||||||
|
if (userLocation == null) return;
|
||||||
final url =
|
final url =
|
||||||
'https://www.google.com/maps/dir/?api=1&destination=$latitude,$longitude';
|
'https://www.google.com/maps/dir/?api=1&origin=${userLocation!.latitude},${userLocation!.longitude}&destination=$latitude,$longitude';
|
||||||
final uri = Uri.parse(url);
|
final uri = Uri.parse(url);
|
||||||
|
|
||||||
if (await canLaunchUrl(uri)) {
|
if (await canLaunchUrl(uri)) {
|
||||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||||
} else {
|
} else {
|
||||||
debugPrint("tidak dapat membuka google maps");
|
toastification.show(
|
||||||
|
type: ToastificationType.error,
|
||||||
|
title: const Text("Gagal membuka Google Maps"),
|
||||||
|
autoCloseDuration: const Duration(seconds: 3),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: CustomAppBar(judul: "Lokasi Pengguna"),
|
||||||
title: const Text("Peta Lokasi"),
|
body:
|
||||||
backgroundColor: Colors.green,
|
userLocation == null
|
||||||
foregroundColor: Colors.white,
|
? const Center(child: CircularProgressIndicator())
|
||||||
),
|
: Stack(
|
||||||
body: Stack(
|
children: [
|
||||||
children: [
|
FlutterMap(
|
||||||
FlutterMap(
|
options: MapOptions(
|
||||||
options: MapOptions(initialCenter: userLocation, initialZoom: 13),
|
initialCenter: userLocation!,
|
||||||
children: [
|
initialZoom: 13,
|
||||||
TileLayer(
|
),
|
||||||
urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
children: [
|
||||||
),
|
TileLayer(
|
||||||
MarkerLayer(
|
urlTemplate:
|
||||||
markers: [
|
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
Marker(
|
),
|
||||||
point: userLocation,
|
MarkerLayer(
|
||||||
child: Icon(Icons.location_on, color: redColor, size: 36),
|
markers: [
|
||||||
|
Marker(
|
||||||
|
point: userLocation!,
|
||||||
|
child: const Icon(
|
||||||
|
Icons.location_on,
|
||||||
|
color: Colors.blue,
|
||||||
|
size: 36,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Marker(
|
||||||
|
point: collectorLocation,
|
||||||
|
child: const Icon(
|
||||||
|
Icons.store,
|
||||||
|
color: Colors.green,
|
||||||
|
size: 36,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
PolylineLayer(
|
||||||
|
polylines: [
|
||||||
|
Polyline(
|
||||||
|
points: [userLocation!, collectorLocation],
|
||||||
|
strokeWidth: 4,
|
||||||
|
color: Colors.orange,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Marker(
|
Positioned(
|
||||||
point: collectorLocation,
|
bottom: 20,
|
||||||
child: Icon(Icons.store, color: primaryColor, size: 36),
|
left: 20,
|
||||||
|
right: 20,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.blue,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
|
),
|
||||||
|
onPressed:
|
||||||
|
() => openMapWithGoogle(
|
||||||
|
collectorLocation.latitude,
|
||||||
|
collectorLocation.longitude,
|
||||||
|
),
|
||||||
|
child: const Text("Buka di Google Maps"),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
PolylineLayer(
|
|
||||||
polylines: [
|
|
||||||
Polyline(
|
|
||||||
points: [userLocation, collectorLocation],
|
|
||||||
strokeWidth: 4,
|
|
||||||
color: Colors.orange,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
bottom: 20,
|
|
||||||
left: 20,
|
|
||||||
right: 20,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: Colors.blue,
|
|
||||||
padding: PaddingCustom().paddingVertical(14),
|
|
||||||
),
|
|
||||||
onPressed:
|
|
||||||
() => openMapWithGoogle(
|
|
||||||
collectorLocation.latitude,
|
|
||||||
collectorLocation.longitude,
|
|
||||||
),
|
|
||||||
child: const Text("Buka di Google Maps"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import connectivity_plus
|
||||||
import device_info_plus
|
import device_info_plus
|
||||||
import file_selector_macos
|
import file_selector_macos
|
||||||
import flutter_secure_storage_macos
|
import flutter_secure_storage_macos
|
||||||
|
import geolocator_apple
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
import shared_preferences_foundation
|
import shared_preferences_foundation
|
||||||
import url_launcher_macos
|
import url_launcher_macos
|
||||||
|
|
@ -18,6 +19,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||||
|
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||||
|
|
|
||||||
96
pubspec.lock
96
pubspec.lock
|
|
@ -384,6 +384,54 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.1"
|
version: "3.0.1"
|
||||||
|
geolocator:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: geolocator
|
||||||
|
sha256: e7ebfa04ce451daf39b5499108c973189a71a919aa53c1204effda1c5b93b822
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "14.0.0"
|
||||||
|
geolocator_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_android
|
||||||
|
sha256: "114072db5d1dce0ec0b36af2697f55c133bc89a2c8dd513e137c0afe59696ed4"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.1+1"
|
||||||
|
geolocator_apple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_apple
|
||||||
|
sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.13"
|
||||||
|
geolocator_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_platform_interface
|
||||||
|
sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.2.6"
|
||||||
|
geolocator_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_web
|
||||||
|
sha256: b1ae9bdfd90f861fde8fd4f209c37b953d65e92823cb73c7dee1fa021b06f172
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.1.3"
|
||||||
|
geolocator_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_windows
|
||||||
|
sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.5"
|
||||||
get_it:
|
get_it:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -752,6 +800,54 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0+3"
|
version: "3.1.0+3"
|
||||||
|
permission_handler:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: permission_handler
|
||||||
|
sha256: "2d070d8684b68efb580a5997eb62f675e8a885ef0be6e754fb9ef489c177470f"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "12.0.0+1"
|
||||||
|
permission_handler_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_android
|
||||||
|
sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "13.0.1"
|
||||||
|
permission_handler_apple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_apple
|
||||||
|
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "9.4.7"
|
||||||
|
permission_handler_html:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_html
|
||||||
|
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3+5"
|
||||||
|
permission_handler_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_platform_interface
|
||||||
|
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.3.0"
|
||||||
|
permission_handler_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_windows
|
||||||
|
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.1"
|
||||||
petitparser:
|
petitparser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ dependencies:
|
||||||
flutter_secure_storage: ^9.2.4
|
flutter_secure_storage: ^9.2.4
|
||||||
flutter_svg: ^2.1.0
|
flutter_svg: ^2.1.0
|
||||||
gap: ^3.0.1
|
gap: ^3.0.1
|
||||||
|
geolocator: ^14.0.0
|
||||||
get_it: ^8.0.3
|
get_it: ^8.0.3
|
||||||
go_router: ^15.1.1
|
go_router: ^15.1.1
|
||||||
google_fonts: ^6.0.0
|
google_fonts: ^6.0.0
|
||||||
|
|
@ -40,6 +41,7 @@ dependencies:
|
||||||
latlong2: ^0.9.1
|
latlong2: ^0.9.1
|
||||||
localstorage: ^6.0.0
|
localstorage: ^6.0.0
|
||||||
path_provider: ^2.1.5
|
path_provider: ^2.1.5
|
||||||
|
permission_handler: ^12.0.0+1
|
||||||
pin_code_fields: ^8.0.1
|
pin_code_fields: ^8.0.1
|
||||||
provider: ^6.1.4
|
provider: ^6.1.4
|
||||||
shared_preferences: ^2.3.3
|
shared_preferences: ^2.3.3
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
|
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
|
||||||
#include <file_selector_windows/file_selector_windows.h>
|
#include <file_selector_windows/file_selector_windows.h>
|
||||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||||
|
#include <geolocator_windows/geolocator_windows.h>
|
||||||
|
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||||
#include <url_launcher_windows/url_launcher_windows.h>
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
|
@ -18,6 +20,10 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
||||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
||||||
|
GeolocatorWindowsRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
||||||
|
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||||
UrlLauncherWindowsRegisterWithRegistrar(
|
UrlLauncherWindowsRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
connectivity_plus
|
connectivity_plus
|
||||||
file_selector_windows
|
file_selector_windows
|
||||||
flutter_secure_storage_windows
|
flutter_secure_storage_windows
|
||||||
|
geolocator_windows
|
||||||
|
permission_handler_windows
|
||||||
url_launcher_windows
|
url_launcher_windows
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue