adding missing const

This commit is contained in:
2025-10-20 17:08:10 +02:00
parent 71c7325370
commit 0070e57aec
36 changed files with 298 additions and 210 deletions

View File

@@ -13,12 +13,12 @@ import 'package:anyway/structs/landmark.dart';
class LandmarkCard extends StatefulWidget {
final Landmark landmark;
final Trip parentTrip;
LandmarkCard(
const LandmarkCard(
this.landmark,
this.parentTrip,
);
@override
_LandmarkCardState createState() => _LandmarkCardState();
}
@@ -26,7 +26,7 @@ class LandmarkCard extends StatefulWidget {
class _LandmarkCardState extends State<LandmarkCard> {
@override
Widget build(BuildContext context) {
Widget build(BuildContext context) {
return Container(
constraints: BoxConstraints(
// express the max height in terms text lines
@@ -38,7 +38,7 @@ class _LandmarkCardState extends State<LandmarkCard> {
),
elevation: 5,
clipBehavior: Clip.antiAliasWithSaveLayer,
// if the image is available, display it on the left side of the card, otherwise only display the text
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -66,11 +66,11 @@ class _LandmarkCardState extends State<LandmarkCard> {
color: PRIMARY_COLOR,
child: Center(
child: Padding(
padding: EdgeInsets.all(5),
padding: const EdgeInsets.all(5),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.timer_outlined, size: 16),
const Icon(Icons.timer_outlined, size: 16),
Text("${widget.landmark.duration?.inMinutes} minutes"),
],
)
@@ -97,7 +97,7 @@ class _LandmarkCardState extends State<LandmarkCard> {
overflow: TextOverflow.ellipsis,
maxLines: 2,
),
if (widget.landmark.nameEN != null)
Text(
widget.landmark.nameEN!,
@@ -114,7 +114,7 @@ class _LandmarkCardState extends State<LandmarkCard> {
SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: EdgeInsets.only(left: 5, right: 5, bottom: 10),
padding: const EdgeInsets.only(left: 5, right: 5, bottom: 10),
// the scroll view should be flush once the buttons are scrolled to the left
// but initially there should be some padding
child: Wrap(
@@ -124,7 +124,7 @@ class _LandmarkCardState extends State<LandmarkCard> {
doneToggleButton(),
if (widget.landmark.websiteURL != null)
websiteButton(),
optionsButton()
],
),
@@ -181,7 +181,7 @@ class _LandmarkCardState extends State<LandmarkCard> {
title: const Text('Favorite'),
onTap: () async {
rootScaffoldMessengerKey.currentState!.showSnackBar(
SnackBar(content: Text("Not implemented yet"))
const SnackBar(content: Text("Not implemented yet"))
);
},
),
@@ -193,7 +193,7 @@ class _LandmarkCardState extends State<LandmarkCard> {
Widget imagePlaceholder (Landmark landmark) => Expanded(
child:
child:
Container(
decoration: const BoxDecoration(
gradient: LinearGradient(