You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

238 lines
8.7 KiB

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import '../common/settings.dart';
class SourceDetailsScreen extends StatefulWidget {
var sourceDetails;
var status;
SourceDetailsScreen({this.sourceDetails, this.status});
@override
State<SourceDetailsScreen> createState() => _SourceDetailsScreenState();
}
class _SourceDetailsScreenState extends State<SourceDetailsScreen> {
final List<Map<String, dynamic>> recentTrips = [
{"type": "Drinking Water", "liters": "10,000 L", "time": "7:02 PM", "date": "28 Jun 2025"},
{"type": "Drinking Water", "liters": "10,000 L", "time": "7:02 PM", "date": "28 Jun 2025"},
{"type": "Drinking Water", "liters": "10,000 L", "time": "7:02 PM", "date": "28 Jun 2025"},
];
void _showMenu() {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
),
builder: (context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
leading: const Icon(Icons.edit, color: Colors.black),
title: const Text('Edit'),
onTap: () => Navigator.pop(context),
),
ListTile(
leading: const Icon(Icons.block, color: Colors.black),
title: const Text('Disable'),
onTap: () => Navigator.pop(context),
),
ListTile(
leading: const Icon(Icons.delete_outline, color: Colors.red),
title: const Text('Delete', style: TextStyle(color: Colors.red)),
onTap: () => Navigator.pop(context),
),
],
),
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black),
onPressed: () => Navigator.pop(context),
),
title: Text( widget.sourceDetails.source_name.isNotEmpty
? widget.sourceDetails.source_name[0].toUpperCase() +
widget.sourceDetails.source_name.substring(1)
: '',
style: fontTextStyle(16, Colors.black, FontWeight.w600)),
actions: [
TextButton(
onPressed: () {},
child: Text("HELP",
style: fontTextStyle(12, const Color(0xFF8270DB), FontWeight.w600)),
),
],
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Image
Stack(
children: [
ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8)),
child: Image.asset(
'images/tanker_image.jpeg', // Replace with your image
height: 200,
width: double.infinity,
fit: BoxFit.cover,
),
),
Positioned(
top: 8,
right: 8,
child: IconButton(
icon: const Icon(Icons.more_vert, color: Colors.white),
onPressed: _showMenu,
),
)
],
),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(widget.sourceDetails.source_name,
style: fontTextStyle(18, Colors.black, FontWeight.w600)),
const SizedBox(height: 4),
Text("Drinking Water",
style: fontTextStyle(14, const Color(0xFF8270DB), FontWeight.w500)),
const SizedBox(height: 4),
Text("+91 789456212",
style: fontTextStyle(14, Colors.black, FontWeight.w400)),
const SizedBox(height: 4),
Text(
"Road No. 12, Krishnadwar Layout,\nGandipet, Hyderabad, 500065",
style: fontTextStyle(13, const Color(0xFF656565), FontWeight.w400),
),
],
),
),
const SizedBox(height: 20),
// Filling & Wait time cards
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
Expanded(
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: const Color(0xFFF7F7F7),
borderRadius: BorderRadius.circular(12),
),
child: Column(
children: [
Text("12",
style: fontTextStyle(20, Colors.black, FontWeight.w600)),
Text("sec/L",
style: fontTextStyle(14, Colors.black, FontWeight.w400)),
const SizedBox(height: 4),
Text("Filling Time",
style: fontTextStyle(12, Colors.grey, FontWeight.w400)),
],
),
),
),
const SizedBox(width: 12),
Expanded(
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: const Color(0xFFF7F7F7),
borderRadius: BorderRadius.circular(12),
),
child: Column(
children: [
Text("24",
style: fontTextStyle(20, Colors.black, FontWeight.w600)),
Text("min",
style: fontTextStyle(14, Colors.black, FontWeight.w400)),
const SizedBox(height: 4),
Text("Wait Time",
style: fontTextStyle(12, Colors.grey, FontWeight.w400)),
],
),
),
),
],
),
),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text("Recent Trips",
style: fontTextStyle(16, Colors.black, FontWeight.w600)),
),
const SizedBox(height: 8),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: recentTrips.length,
itemBuilder: (context, index) {
final trip = recentTrips[index];
return Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: const Color(0xFFF7F7F7),
borderRadius: BorderRadius.circular(12),
),
child: Row(
children: [
const Icon(Icons.water_drop, color: Color(0xFF8270DB)),
const SizedBox(width: 12),
Expanded(
child: Text(
"${trip['type']} - ${trip['liters']}",
style: fontTextStyle(
14, const Color(0xFF2D2E30), FontWeight.w500),
),
),
Text(
"${trip['time']}, ${trip['date']}",
style: fontTextStyle(
12, const Color(0xFF656565), FontWeight.w400),
),
],
),
),
);
},
),
const SizedBox(height: 20),
],
),
),
);
}
}