feat: basic navigation with bugs

This commit is contained in:
2024-04-21 08:24:50 +02:00
parent e653010458
commit 3de71e2a5a
13 changed files with 1391 additions and 92 deletions

View File

@ -19,8 +19,8 @@ Future<void> showFeatureBottomSheet(
data: ThemeData.light(),
child: Container(
constraints: const BoxConstraints(
minHeight: 300,
),
// minHeight: 300,
),
width: Get.mediaQuery.size.width,
decoration: const BoxDecoration(
color: Colors.black,
@ -72,6 +72,28 @@ Future<void> showFeatureBottomSheet(
const SizedBox(height: 10),
],
..._buildFeatureContent(feature),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
child: const Row(
children: [
Icon(
Icons.share_location,
color: Colors.black,
),
SizedBox(width: 4),
Text(
"Start Navigation",
style: TextStyle(color: Colors.black),
),
],
),
onPressed: () => {},
),
],
)
]),
),
),
@ -114,7 +136,35 @@ List<Widget> _buildRoomContent(Feature feature) {
/// Builds the content for the Door feature type.
List<Widget> _buildDoorContent(Feature feature, List<String> connects) {
return [Text('Door: ${feature.name}\nConnects: $connects')];
return [
Text(
feature.name,
style: const TextStyle(fontSize: 18),
),
const SizedBox(height: 10),
if (connects.isNotEmpty) ...[
const Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(right: 4),
child: Text(
'Connects:',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
),
Align(
alignment: Alignment.centerLeft,
child: Wrap(
spacing: 8,
runSpacing: 4,
children: connects.map((place) {
return ColorfulChip(label: place.toString());
}).toList(),
),
),
],
];
}
/// Builds the content for the Toilet feature type.

View File

@ -10,38 +10,39 @@ import 'package:uninav/map.dart';
import 'package:uninav/util/geomath.dart';
import 'package:uninav/util/util.dart';
List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
List<Widget> renderLevel(
int level,
) {
return <Widget>[
LevelLayer(
filter: (feature) =>
feature.level == level && feature.type is LectureHall,
polyConstructor: (feature) => feature
.getPolygon(
constructor: (pts) => Polygon(
points: pts,
color: Colors.orange.withOpacity(0.2),
borderColor: Colors.orange,
borderStrokeWidth: 2,
hitValue: feature,
),
)
.unwrap(),
markerConstructor: (feature) => Marker(
width: 50,
height: 20,
point: feature.getPoint().unwrap(),
child: Column(
children: [
Icon(
Icons.class_,
color: Colors.black,
),
Text('${feature.name}'),
],
),
alignment: Alignment.center,
filter: (feature) =>
feature.level == level && feature.type is LectureHall,
polyConstructor: (feature) => feature
.getPolygon(
constructor: (pts) => Polygon(
points: pts,
color: Colors.orange.withOpacity(0.2),
borderColor: Colors.orange,
borderStrokeWidth: 2,
),
notifier: hitNotifier),
)
.unwrap(),
markerConstructor: (feature) => Marker(
width: 50,
height: 20,
point: feature.getPoint().unwrap(),
child: Column(
children: [
Icon(
Icons.class_,
color: Colors.black,
),
Text('${feature.name}'),
],
),
alignment: Alignment.center,
),
),
LevelLayer(
filter: (feature) => feature.level == level && feature.type is Room,
polyConstructor: (feature) => feature
@ -51,11 +52,9 @@ List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
color: Colors.green.withOpacity(1.2),
borderColor: Colors.green,
borderStrokeWidth: 2,
hitValue: feature,
),
)
.unwrap(),
notifier: hitNotifier,
),
LevelLayer(
filter: (feature) => feature.level == level && feature.type is Door,
@ -72,7 +71,6 @@ List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
alignment: Alignment.center,
);
},
notifier: hitNotifier,
),
LevelLayer(
filter: (feature) => feature.level == level && feature.type is Toilet,
@ -91,7 +89,6 @@ List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
alignment: Alignment.center,
);
},
notifier: hitNotifier,
),
LevelLayer(
filter: (feature) =>
@ -110,7 +107,6 @@ List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
alignment: Alignment.center,
);
},
notifier: hitNotifier,
),
LevelLayer(
filter: (feature) =>
@ -129,7 +125,6 @@ List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
alignment: Alignment.center,
);
},
notifier: hitNotifier,
),
];
}
@ -140,7 +135,6 @@ class LevelLayer extends StatelessWidget {
final Marker Function(LatLng, String)? polyCenterMarkerConstructor;
final Marker Function(Feature)? markerConstructor;
final int? level;
final LayerHitNotifier? notifier;
const LevelLayer({
this.level,
@ -148,7 +142,6 @@ class LevelLayer extends StatelessWidget {
this.polyConstructor,
this.polyCenterMarkerConstructor,
this.markerConstructor,
this.notifier,
super.key,
});
@ -173,7 +166,6 @@ class LevelLayer extends StatelessWidget {
points: points,
borderColor: Colors.black26,
borderStrokeWidth: 2.0,
hitValue: feature,
))
.unwrap());
}
@ -241,14 +233,12 @@ class LevelLayer extends StatelessWidget {
widgets.add(TranslucentPointer(
child: PolygonLayer(
polygons: filteredPolygons,
hitNotifier: notifier,
),
));
} else {
widgets.add(TranslucentPointer(
child: PolygonLayer(
polygons: filteredPolygons,
hitNotifier: notifier,
),
));
}