Files
anyway/frontend/lib/presentation/widgets/trip_details/trip_hero_header.dart

63 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:anyway/core/constants.dart';
import 'package:anyway/presentation/utils/trip_location_utils.dart';
class TripHeroHeader extends StatelessWidget {
const TripHeroHeader({super.key, this.localeInfo});
final TripLocaleInfo? localeInfo;
@override
Widget build(BuildContext context) {
final resolvedCity = localeInfo?.hasResolvedCity == true ? localeInfo!.cityName : null;
final title = resolvedCity == null ? 'Welcome to your trip!' : 'Welcome to $resolvedCity!';
final flag = localeInfo?.flagEmoji ?? '🏁';
return SizedBox(
height: 70,
child: Center(
child: FittedBox(
fit: BoxFit.scaleDown,
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
DecoratedBox(
decoration: const BoxDecoration(shape: BoxShape.circle, color: Color(0x11000000)),
child: Padding(
padding: const EdgeInsets.all(10),
child: Text(flag, style: const TextStyle(fontSize: 26)),
),
),
const SizedBox(width: 12),
_GradientText(title, style: Theme.of(context).textTheme.titleLarge?.copyWith(fontWeight: FontWeight.w800, letterSpacing: -0.2)),
],
),
),
),
);
}
}
class _GradientText extends StatelessWidget {
const _GradientText(this.text, {this.style});
final String text;
final TextStyle? style;
@override
Widget build(BuildContext context) {
return ShaderMask(
shaderCallback: (bounds) => APP_GRADIENT.createShader(Rect.fromLTWH(0, 0, bounds.width, bounds.height)),
blendMode: BlendMode.srcIn,
child: Text(
text,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: (style ?? const TextStyle(fontSize: 24, fontWeight: FontWeight.bold)).copyWith(color: Colors.white),
),
);
}
}