feat: major progress

This commit is contained in:
2024-04-21 02:22:53 +02:00
parent 13327da5de
commit e653010458
18 changed files with 1464 additions and 59 deletions

View File

@ -14,7 +14,10 @@ class ColorfulChip extends StatelessWidget {
labelStyle: TextStyle(
color: color.computeLuminance() > 0.5 ? Colors.black : Colors.white,
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide.none,
),
);
}
}
@ -22,11 +25,13 @@ class ColorfulChip extends StatelessWidget {
class ColorfulActionChip extends StatelessWidget {
final String label;
final VoidCallback onPressed;
final double? size;
const ColorfulActionChip({
Key? key,
required this.label,
required this.onPressed,
this.size,
}) : super(key: key);
@override
@ -38,9 +43,15 @@ class ColorfulActionChip extends StatelessWidget {
backgroundColor: color,
labelStyle: TextStyle(
color: color.computeLuminance() > 0.5 ? Colors.black : Colors.white,
fontSize: size,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide.none,
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
onPressed: onPressed,
padding: EdgeInsets.symmetric(
horizontal: (size ?? 16) / 2, vertical: (size ?? 8.0) / 2),
);
}
}

View File

@ -18,7 +18,9 @@ Future<void> showFeatureBottomSheet(
Theme(
data: ThemeData.light(),
child: Container(
height: 300,
constraints: const BoxConstraints(
minHeight: 300,
),
width: Get.mediaQuery.size.width,
decoration: const BoxDecoration(
color: Colors.black,
@ -26,7 +28,7 @@ Future<void> showFeatureBottomSheet(
topLeft: Radius.circular(30), topRight: Radius.circular(30)),
),
padding: const EdgeInsets.all(20),
child: Column(children: [
child: Column(mainAxisSize: MainAxisSize.min, children: [
Center(
child: Container(
width: 50,
@ -65,6 +67,10 @@ Future<void> showFeatureBottomSheet(
),
const SizedBox(height: 14),
],
if (feature.description != null) ...[
Text(feature.description!),
const SizedBox(height: 10),
],
..._buildFeatureContent(feature),
]),
),
@ -113,17 +119,89 @@ List<Widget> _buildDoorContent(Feature feature, List<String> connects) {
/// Builds the content for the Toilet feature type.
List<Widget> _buildToiletContent(Feature feature, String toiletType) {
return [Text('Toilet: ${feature.name}\nType: $toiletType')];
return [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.wc,
size: 60,
color: Colors.white,
),
Icon(
findToiletIcon(toiletType),
size: 60,
color: Colors.white,
)
],
)
];
}
/// Builds the content for the Stairs feature type.
List<Widget> _buildStairsContent(Feature feature, List<int> connectsLevels) {
return [Text('Stairs: ${feature.name}\nConnects Levels: $connectsLevels')];
return [
Text(
feature.name,
style: const TextStyle(fontSize: 18),
),
const SizedBox(height: 10),
if (connectsLevels.isNotEmpty) ...[
const Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(right: 4),
child: Text(
'Connects Levels:',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
),
Align(
alignment: Alignment.centerLeft,
child: Wrap(
spacing: 8,
runSpacing: 4,
children: connectsLevels.map((level) {
return ColorfulChip(label: level.toString());
}).toList(),
),
),
],
];
}
/// Builds the content for the Lift feature type.
List<Widget> _buildLiftContent(Feature feature, List<int> connectsLevels) {
return [Text('Lift: ${feature.name}\nConnects Levels: $connectsLevels')];
return [
Text(
feature.name,
style: const TextStyle(fontSize: 18),
),
const SizedBox(height: 10),
if (connectsLevels.isNotEmpty) ...[
const Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(right: 4),
child: Text(
'Connects Levels:',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
),
Align(
alignment: Alignment.centerLeft,
child: Wrap(
spacing: 8,
runSpacing: 4,
children: connectsLevels.map((level) {
return ColorfulChip(label: level.toString());
}).toList(),
),
),
],
];
}
/// Builds the content for the PublicTransport feature type.

View File

@ -8,6 +8,7 @@ import 'package:uninav/controllers/map_controller.dart';
import 'package:uninav/data/geo/model.dart';
import 'package:uninav/map.dart';
import 'package:uninav/util/geomath.dart';
import 'package:uninav/util/util.dart';
List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
return <Widget>[
@ -77,24 +78,6 @@ List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
filter: (feature) => feature.level == level && feature.type is Toilet,
markerConstructor: (feature) {
final type = (feature.type as Toilet).toilet_type;
IconData icon;
switch (type.toLowerCase()) {
case 'male':
icon = Icons.male;
break;
case 'female':
icon = Icons.female;
break;
case 'handicap':
icon = Icons.wheelchair_pickup;
break;
default:
print("WARN: Toilet didn't have recognizable type! "
"(Level ${feature.level}, Name ${feature.name}, "
"Location: ${feature.getPoint().unwrap()})");
icon = Icons.wc;
break;
}
final point = feature.getPoint().unwrap();
return Marker(
@ -102,7 +85,7 @@ List<Widget> renderLevel(int level, {LayerHitNotifier? hitNotifier}) {
height: 21,
point: point,
child: Icon(
icon,
findToiletIcon(type),
color: Colors.purple,
),
alignment: Alignment.center,