work from bae
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_banner_ad.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_business_profile_preview.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_personal_profile_preview.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/business_profile/components/mih_business_card.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_location_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
|
||||
@@ -28,9 +32,11 @@ import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_
|
||||
|
||||
class PackageToolOne extends StatefulWidget {
|
||||
final AppUser user;
|
||||
final Business business;
|
||||
const PackageToolOne({
|
||||
super.key,
|
||||
required this.user,
|
||||
required this.business,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -57,6 +63,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
bool switchpositioin = true;
|
||||
final FocusNode searchFocusNode = FocusNode();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late Future<Position?> myCoordinates;
|
||||
String myLocation = "";
|
||||
|
||||
void showTestFullWindow() {
|
||||
showDialog(
|
||||
@@ -139,6 +147,8 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
// const NetworkImage(
|
||||
// "https://lh3.googleusercontent.com/nW4ZZ89Q1ATz7Ht3nsAVWXL_cwNi4gNusqQZiL60UuuI3FG-VM7bTYDoJ-sUr2kDTdorfQYjxo5PjDM-0MO5rA=s512");
|
||||
});
|
||||
|
||||
// myCoordinates = MIHLocationAPI().getGPSPosition(context);
|
||||
}
|
||||
|
||||
Widget getBody(double width) {
|
||||
@@ -172,10 +182,95 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Personal Preview",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MihPersonalProfilePreview(
|
||||
user: widget.user,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Business Preview",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
FutureBuilder(
|
||||
future: MIHLocationAPI().getGPSPosition(context),
|
||||
builder: (context, asyncSnapshot) {
|
||||
// print(asyncSnapshot.connectionState);
|
||||
if (asyncSnapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return Container(
|
||||
width: 150,
|
||||
height: 50,
|
||||
color: Colors.black,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
} else if (asyncSnapshot.hasError ||
|
||||
!asyncSnapshot.hasData ||
|
||||
asyncSnapshot.data == null) {
|
||||
return Container(
|
||||
width: 150,
|
||||
height: 50,
|
||||
color: Colors.red,
|
||||
child: Center(child: Text("Location unavailable")),
|
||||
);
|
||||
} else {
|
||||
final myLocation = asyncSnapshot.data
|
||||
.toString()
|
||||
.replaceAll("Latitude: ", "")
|
||||
.replaceAll("Longitude: ", "");
|
||||
print("My Location is this: $myLocation");
|
||||
return MihBusinessProfilePreview(
|
||||
business: widget.business,
|
||||
myLocation: myLocation,
|
||||
);
|
||||
}
|
||||
// // print(asyncSnapshot.requireData);
|
||||
// if (asyncSnapshot.connectionState ==
|
||||
// ConnectionState.done &&
|
||||
// asyncSnapshot.hasData) {
|
||||
// print(asyncSnapshot.requireData);
|
||||
// myLocation = asyncSnapshot.requireData.toString();
|
||||
// return MihBusinessProfilePreview(
|
||||
// business: widget.business,
|
||||
// myLocation: myLocation,
|
||||
// );
|
||||
// } else {
|
||||
// return Container(
|
||||
// width: 150,
|
||||
// height: 50,
|
||||
// color: Colors.black,
|
||||
// );
|
||||
// }
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
MihBusinessCard(
|
||||
businessName: "Mzansi Innovation Hub",
|
||||
cellNumber: "0788300006",
|
||||
|
||||
Reference in New Issue
Block a user