use more fitting floating action button, cleanup
All checks were successful
Build and release APK / Build APK (pull_request) Successful in 5m24s
All checks were successful
Build and release APK / Build APK (pull_request) Successful in 5m24s
This commit is contained in:
64
frontend/lib/modules/current_trip_landmarks_list.dart
Normal file
64
frontend/lib/modules/current_trip_landmarks_list.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'dart:developer';
|
||||
import 'package:anyway/modules/step_between_landmarks.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:anyway/modules/landmark_card.dart';
|
||||
import 'package:anyway/structs/landmark.dart';
|
||||
import 'package:anyway/structs/trip.dart';
|
||||
import 'package:anyway/main.dart';
|
||||
|
||||
|
||||
|
||||
List<Widget> landmarksList(Trip trip) {
|
||||
log("Trip ${trip.uuid} ${trip.landmarks.length} landmarks");
|
||||
|
||||
List<Widget> children = [];
|
||||
|
||||
log("Trip ${trip.uuid} ${trip.landmarks.length} landmarks");
|
||||
|
||||
if (trip.landmarks.isEmpty || trip.landmarks.length <= 1 && trip.landmarks.first.type == start ) {
|
||||
children.add(
|
||||
const Text("No landmarks in this trip"),
|
||||
);
|
||||
return children;
|
||||
}
|
||||
|
||||
for (Landmark landmark in trip.landmarks) {
|
||||
children.add(
|
||||
Dismissible(
|
||||
key: ValueKey<int>(landmark.hashCode),
|
||||
child: LandmarkCard(landmark),
|
||||
dismissThresholds: {DismissDirection.endToStart: 0.95, DismissDirection.startToEnd: 0.95},
|
||||
onDismissed: (direction) {
|
||||
log('Removing ${landmark.name}');
|
||||
trip.removeLandmark(landmark);
|
||||
// Then show a snackbar
|
||||
|
||||
rootScaffoldMessengerKey.currentState!.showSnackBar(
|
||||
SnackBar(content: Text("We won't show ${landmark.name} again"))
|
||||
);
|
||||
},
|
||||
|
||||
background: Container(color: Colors.red),
|
||||
secondaryBackground: Container(
|
||||
color: Colors.red,
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
color: Colors.white,
|
||||
),
|
||||
padding: EdgeInsets.all(15),
|
||||
alignment: Alignment.centerRight,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
if (landmark.next != null) {
|
||||
children.add(
|
||||
StepBetweenLandmarks(current: landmark, next: landmark.next!)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
Reference in New Issue
Block a user