57 lines
1.9 KiB
Dart
57 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:hl_lieferservice/feature/car_selection/bloc/bloc.dart';
|
|
import 'package:hl_lieferservice/feature/car_selection/bloc/events.dart';
|
|
import 'package:hl_lieferservice/feature/car_selection/bloc/state.dart';
|
|
|
|
class SelectedCarBar extends StatelessWidget {
|
|
const SelectedCarBar({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<CarSelectBloc, CarSelectState>(
|
|
builder: (context, state) {
|
|
if (state is! CarSelectComplete) return const SizedBox.shrink();
|
|
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Divider(height: 1, thickness: 1),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
Icons.local_shipping,
|
|
size: 20,
|
|
color: Theme.of(context).primaryColor,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Text(
|
|
state.selectedCar.plate,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
color: Theme.of(context).primaryColor,
|
|
),
|
|
),
|
|
),
|
|
OutlinedButton.icon(
|
|
onPressed: () =>
|
|
context.read<CarSelectBloc>().add(CarSelectChange()),
|
|
icon: const Icon(Icons.swap_horiz, size: 18),
|
|
label: const Text("Wechseln"),
|
|
style: OutlinedButton.styleFrom(
|
|
visualDensity: VisualDensity.compact,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|