WIP: loading indicator
All checks were successful
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 4m9s
Build and release debug APK / Build APK (pull_request) Successful in 10m28s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 56s

This commit is contained in:
2024-12-18 13:09:53 +01:00
parent d992b62533
commit dd48fda99f
3 changed files with 179 additions and 12 deletions

View File

@@ -34,29 +34,85 @@ Widget loadingText(Trip trip) => FutureBuilder(
Widget greeter;
if (snapshot.hasData) {
greeter = AutoSizeText(
maxLines: 1,
'Generating your trip to ${snapshot.data}...',
greeter = AnimatedGradientText(
text: 'Generating your trip to ${snapshot.data}...',
style: greeterStyle,
);
} else if (snapshot.hasError) {
// the exact error is shown in the central part of the trip overview. No need to show it here
greeter = AutoSizeText(
maxLines: 1,
'Error while loading trip.',
greeter = AnimatedGradientText(
text: 'Error while loading trip.',
style: greeterStyle,
);
);
} else {
greeter = AutoSizeText(
maxLines: 1,
'Generating your trip...',
greeter = AnimatedGradientText(
text: 'Generating your trip...',
style: greeterStyle,
);
);
}
return greeter;
}
);
class AnimatedGradientText extends StatefulWidget {
final String text;
final TextStyle style;
const AnimatedGradientText({
Key? key,
required this.text,
required this.style,
}) : super(key: key);
@override
_AnimatedGradientTextState createState() => _AnimatedGradientTextState();
}
class _AnimatedGradientTextState extends State<AnimatedGradientText> with SingleTickerProviderStateMixin {
late AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(seconds: 1),
vsync: this,
)..repeat();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return ShaderMask(
shaderCallback: (bounds) {
return LinearGradient(
colors: [Colors.blue, Colors.red, Colors.blue],
stops: [
_controller.value - 1.0,
_controller.value,
_controller.value + 1.0,
],
tileMode: TileMode.mirror,
).createShader(bounds);
},
child: Text(
widget.text,
style: widget.style,
),
);
},
);
}
}

View File

@@ -125,7 +125,7 @@ class LandmarkType {
LandmarkType({required this.name, this.icon = const Icon(Icons.location_on)}) {
switch (name) {
case 'sightseeing':
icon = const Icon(Icons.church);
icon = const Icon(Icons.castle);
break;
case 'nature':
icon = const Icon(Icons.eco);