TKK_E32221002/lib/app/modules/info/views/info_view.dart

91 lines
2.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class InfoView extends StatelessWidget {
const InfoView({super.key});
static const Color primaryColor = Color(0xFF1E3A8A);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: primaryColor,
elevation: 6,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(bottom: Radius.circular(20)),
),
title: Text(
'Informasi Kadar Fe',
style: GoogleFonts.poppins(
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
centerTitle: true,
iconTheme: const IconThemeData(color: Colors.white),
),
body: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Tabel Kadar Zat Besi dan Kondisi Air',
style: GoogleFonts.poppins(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 16),
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Table(
columnWidths: const {
0: FlexColumnWidth(1),
1: FlexColumnWidth(1),
2: FlexColumnWidth(1),
},
border: TableBorder.all(
color: Colors.grey.shade300,
width: 1,
),
children: [
_tabelBaris(["Kadar Fe (mg/L)", "Tingkat", "Kondisi"], isHeader: true),
_tabelBaris(["≤ 0.3", "Rendah", "Bersih"]),
_tabelBaris(["0.3 - 1.0", "Sedang", "Perlu Penyaringan"]),
_tabelBaris(["> 1.0", "Tinggi", "Keruh (Tercemar)"]),
],
),
),
],
),
),
);
}
TableRow _tabelBaris(List<String> data, {bool isHeader = false}) {
return TableRow(
decoration: BoxDecoration(
color: isHeader
? primaryColor
: Colors.grey.shade100,
),
children: data.map((text) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Text(
text,
textAlign: TextAlign.center,
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: isHeader ? FontWeight.bold : FontWeight.normal,
color: isHeader ? Colors.white : Colors.black87,
),
),
);
}).toList(),
);
}
}