176 lines
6.2 KiB
Dart
176 lines
6.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import '../controller/gasstations_controller.dart';
|
|
import '../widgets/gasstation_card_widget.dart';
|
|
|
|
class GasstationsPage extends GetView<GasstationsController> {
|
|
static const String namedRoute = '/gasstations-page';
|
|
const GasstationsPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var staCtrl = controller;
|
|
return SafeArea(
|
|
child: Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.blueGrey[800],
|
|
foregroundColor: Colors.white,
|
|
elevation: 0,
|
|
title: const Row(
|
|
children: [
|
|
Icon(Icons.local_gas_station, size: 28),
|
|
SizedBox(width: 12),
|
|
Text(
|
|
'Tankstellen',
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 22),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
body: Container(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
Colors.blueGrey[800]!,
|
|
Colors.blueGrey[600]!,
|
|
Colors.blueGrey[400]!,
|
|
Colors.blueGrey[200]!,
|
|
],
|
|
),
|
|
),
|
|
child: Obx(() {
|
|
if (staCtrl.isLoading.value) {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const CircularProgressIndicator(
|
|
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
|
strokeWidth: 3,
|
|
),
|
|
const SizedBox(height: 20),
|
|
Text(
|
|
'Lade Tankstellen...',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
} else if (staCtrl.eControlData.isEmpty) {
|
|
return Center(
|
|
child: Container(
|
|
margin: const EdgeInsets.all(24),
|
|
padding: const EdgeInsets.all(32),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(20),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.1),
|
|
blurRadius: 10,
|
|
offset: const Offset(0, 5),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(
|
|
Icons.search_off,
|
|
size: 64,
|
|
color: Colors.blueGrey[300],
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'Keine Tankstellen gefunden',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.blueGrey[800],
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'Bitte überprüfen Sie Ihre Standortfreigabe',
|
|
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
} else {
|
|
return Column(
|
|
children: [
|
|
// Info Header
|
|
Container(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 20,
|
|
vertical: 12,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.95),
|
|
borderRadius: BorderRadius.circular(12),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.1),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(
|
|
Icons.info_outline,
|
|
color: Colors.blueGrey[700],
|
|
size: 20,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'Top 5 von ${staCtrl.eControlData.length} Tankstellen',
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.blueGrey[800],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
// List
|
|
Expanded(
|
|
child: ListView.builder(
|
|
padding: const EdgeInsets.only(bottom: 16),
|
|
itemCount: staCtrl.eControlData.length > 5
|
|
? 5
|
|
: staCtrl.eControlData.length,
|
|
itemBuilder: (context, index) {
|
|
return GasStationCard(
|
|
station: staCtrl.eControlData[index],
|
|
index: index,
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|