Skip to content

Commit

Permalink
Merge pull request #77 from JordyHers-org/bugfix/72-use-trailing-commas
Browse files Browse the repository at this point in the history
Bugfix/72 use trailing commas
  • Loading branch information
JordyHers authored Jun 4, 2023
2 parents 0725d9a + d43efe3 commit e4f13a6
Show file tree
Hide file tree
Showing 44 changed files with 1,069 additions and 788 deletions.
13 changes: 11 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
include : package:pedantic/analysis_options.1.9.0.yaml

include: package:pedantic/analysis_options.1.9.0.yaml

linter:
rules:
- require_trailing_commas
- prefer_const_declarations
- lines_longer_than_80_chars
- always_declare_return_types
- prefer_final_fields
- prefer_single_quotes
- file_names
- avoid_print
40 changes: 24 additions & 16 deletions lib/app/config/geo_full.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ class _GeoFullState extends State<GeoFull> {

//TODO:Make function async
Future<List<Marker>> initMarker(Map<String, dynamic> data) async {
if (data != null) {
allMarkers.add(Marker(
allMarkers.add(
Marker(
infoWindow: InfoWindow(
title: data['id'],
snippet: data['name'],
onTap: () {
print('Tapped');
}),
title: data['id'],
snippet: data['name'],
onTap: () {
print('Tapped');
},
),
markerId: MarkerId(data['id']),
icon:
BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueMagenta),
Expand All @@ -87,10 +88,10 @@ class _GeoFullState extends State<GeoFull> {
print('Marker Tapped');
},
position: LatLng(data['position'].latitude, data['position'].longitude),
));
),
);

return allMarkers;
}
return allMarkers;
return [];
}

Expand All @@ -101,9 +102,12 @@ class _GeoFullState extends State<GeoFull> {
child: Center(
child: GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(widget.initialPosition.latitude,
widget.initialPosition.longitude),
zoom: 15),
target: LatLng(
widget.initialPosition.latitude,
widget.initialPosition.longitude,
),
zoom: 15,
),
mapType: MapType.normal,
myLocationEnabled: true,
onMapCreated: (GoogleMapController controller) {
Expand All @@ -121,9 +125,13 @@ class _GeoFullState extends State<GeoFull> {

Future<void> centerScreen(Position position) async {
final controller = await _controller.future;
await controller.animateCamera(CameraUpdate.newCameraPosition(
await controller.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(position.latitude, position.longitude),
zoom: 16.0)));
target: LatLng(position.latitude, position.longitude),
zoom: 16.0,
),
),
);
}
}
49 changes: 30 additions & 19 deletions lib/app/config/geo_location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,27 @@ class _GeoState extends State<Geo> {
print(data['id']);
print(data['position']?.latitude);
print(data['position']?.longitude);
allMarkers.add(Marker(
infoWindow: InfoWindow(
allMarkers.add(
Marker(
infoWindow: InfoWindow(
title: data['id'],
snippet: data['name'],
onTap: () {
print('Tapped');
}),
markerId: MarkerId(data['id']),
//TODO:Implement child image as marker
//icon: BitmapDescriptor.fromBytes(imageData),
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueMagenta),
draggable: false,
onTap: () {
print('Marker Tapped');
},
position: LatLng(data['position'].latitude, data['position'].longitude),
));
},
),
markerId: MarkerId(data['id']),
//TODO:Implement child image as marker
//icon: BitmapDescriptor.fromBytes(imageData),
icon:
BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueMagenta),
draggable: false,
onTap: () {
print('Marker Tapped');
},
position: LatLng(data['position'].latitude, data['position'].longitude),
),
);
print(allMarkers);
return allMarkers;
}
Expand All @@ -107,9 +111,12 @@ class _GeoState extends State<Geo> {
myLocationEnabled: true,
markers: Set<Marker>.of(allMarkers),
initialCameraPosition: CameraPosition(
target: LatLng(widget.initialPosition.latitude,
widget.initialPosition.longitude),
zoom: 15),
target: LatLng(
widget.initialPosition.latitude,
widget.initialPosition.longitude,
),
zoom: 15,
),
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
setState(() {
Expand All @@ -123,9 +130,13 @@ class _GeoState extends State<Geo> {

Future<void> centerScreen(Position position) async {
final controller = await _controller.future;
await controller.animateCamera(CameraUpdate.newCameraPosition(
await controller.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(position.latitude, position.longitude),
zoom: 16.0)));
target: LatLng(position.latitude, position.longitude),
zoom: 16.0,
),
),
);
}
}
103 changes: 52 additions & 51 deletions lib/app/landing_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,61 +41,62 @@ class _LandingPageState extends State<LandingPage> {
Widget build(BuildContext context) {
final auth = Provider.of<AuthBase>(context, listen: false);
return StreamBuilder<User?>(
///auth.authStateChanges is the stream declared in the [auth.dart] class
stream: auth.authStateChanges(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.active) {
final user = snapshot.data;
if (user == null) {
return SignInPage.create(context);
}

///auth.authStateChanges is the stream declared in the [auth.dart] class
stream: auth.authStateChanges(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.active) {
final user = snapshot.data;
if (user == null) {
return SignInPage.create(context);
}

/// Here we have added a provider [Database] as a parent of the Parent
/// Page
switch (_isParent) {
/// THIS CASE SET THE APP AS A PARENT APP
case true:
return Provider<Database>(
create: (_) => FirestoreDatabase(uid: user.uid),
/// Here we have added a provider [Database] as a parent of the Parent
/// Page
switch (_isParent) {
/// THIS CASE SET THE APP AS A PARENT APP
case true:
return Provider<Database>(
create: (_) => FirestoreDatabase(uid: user.uid),

///Here the ShowCaseWidget triggers the Showcase view and passes the context
child: FutureProvider(
initialData: null,
create: (context) => geoService.getInitialLocation(),
child: ShowCaseWidget(
builder: Builder(
builder: (context) =>
ParentPage.create(context, auth)),
autoPlay: false,
///Here the ShowCaseWidget triggers the Showcase view and passes the context
child: FutureProvider(
initialData: null,
create: (context) => geoService.getInitialLocation(),
child: ShowCaseWidget(
builder: Builder(
builder: (context) => ParentPage.create(context, auth),
),
autoPlay: false,

//autoPlayDelay: Duration(seconds: 3),
// autoPlayLockEnable: true,
),
));
case false:
//autoPlayDelay: Duration(seconds: 3),
// autoPlayLockEnable: true,
),
),
);
case false:

/// THIS CASE SET THE APP AS A PARENT APP
return Provider<AuthBase>(
create: (_) => Auth(),
child: Provider<Database>(
create: (_) =>
FirestoreDatabase(auth: auth, uid: user.uid),
child: FutureProvider(
initialData: geoService.getCurrentLocation,
create: (context) => geoService.getInitialLocation(),
child: SetChildPage.create(context),
)),
);
default:
return CircularProgressIndicator();
}
/// THIS CASE SET THE APP AS A PARENT APP
return Provider<AuthBase>(
create: (_) => Auth(),
child: Provider<Database>(
create: (_) => FirestoreDatabase(auth: auth, uid: user.uid),
child: FutureProvider(
initialData: geoService.getCurrentLocation,
create: (context) => geoService.getInitialLocation(),
child: SetChildPage.create(context),
),
),
);
default:
return CircularProgressIndicator();
}
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
});
}
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
},
);
}
}
Loading

0 comments on commit e4f13a6

Please sign in to comment.