FE baru untuk history,dasahboard,riwayat
This commit is contained in:
parent
b8dcc027ca
commit
6ded76c325
Binary file not shown.
After Width: | Height: | Size: 2.2 MiB |
|
@ -1,4 +1,7 @@
|
||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'history_page.dart';
|
||||||
|
|
||||||
class DashboardPage extends StatefulWidget {
|
class DashboardPage extends StatefulWidget {
|
||||||
const DashboardPage({Key? key}) : super(key: key);
|
const DashboardPage({Key? key}) : super(key: key);
|
||||||
|
@ -13,9 +16,12 @@ class _DashboardPageState extends State<DashboardPage>
|
||||||
double humidity = 0.0;
|
double humidity = 0.0;
|
||||||
bool fanOn = false;
|
bool fanOn = false;
|
||||||
bool pumpOn = false;
|
bool pumpOn = false;
|
||||||
|
int _selectedIndex = 0;
|
||||||
late AnimationController _controller;
|
late AnimationController _controller;
|
||||||
late Animation<double> _fadeAnim;
|
late Animation<double> _fadeAnim;
|
||||||
|
|
||||||
|
List<HistoryEntry> history = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -36,378 +42,611 @@ class _DashboardPageState extends State<DashboardPage>
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
void _onNavTapped(int index) {
|
||||||
Widget build(BuildContext context) {
|
if (_selectedIndex != index) {
|
||||||
|
setState(() {
|
||||||
|
_selectedIndex = index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _addHistory() {
|
||||||
|
history.add(HistoryEntry(
|
||||||
|
time: DateTime.now(),
|
||||||
|
temperature: temperature,
|
||||||
|
humidity: humidity,
|
||||||
|
fanOn: fanOn,
|
||||||
|
pumpOn: pumpOn,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildDashboard(BuildContext context) {
|
||||||
final size = MediaQuery.of(context).size;
|
final size = MediaQuery.of(context).size;
|
||||||
final cardWidth = size.width * 0.90;
|
final width = size.width;
|
||||||
final cardHeight = size.height * 0.15;
|
final height = size.height;
|
||||||
final iconSize = size.width * 0.13;
|
|
||||||
final fontSize = size.width * 0.052;
|
|
||||||
final time = TimeOfDay.now().format(context);
|
|
||||||
// Palet warna
|
// Palet warna
|
||||||
const greenPrimary = Color(0xFF1CB56B);
|
const greenPrimary = Color(0xFF1CB56B);
|
||||||
const greenGradientStart = Color(0xFF43EA7A);
|
const greenGradientStart = Color(0xFF43EA7A);
|
||||||
const greenBg = Color(0xFFF6FFF9);
|
const greenBg = Color(0xFFF6FFF9);
|
||||||
const blueTemp = Color(0xFF4FC3F7);
|
const blueTemp = Color(0xFF4FC3F7);
|
||||||
const blueHumidity = Color(0xFF0288D1);
|
const blueHumidity = Color(0xFF0288D1);
|
||||||
const yellowBadge = Color(0xFFFFF9C4);
|
final time = TimeOfDay.now().format(context);
|
||||||
const cardShadow = Color(0x331CB56B);
|
|
||||||
const borderRadius = 24.0;
|
// Header
|
||||||
|
final headerHeight = height * 0.17;
|
||||||
|
final logoSize = width * 0.10;
|
||||||
|
final welcomeFont = width * 0.045;
|
||||||
|
final timeFont = width * 0.032;
|
||||||
|
|
||||||
|
// Grid
|
||||||
|
final gridPadding = width * 0.04;
|
||||||
|
final gridSpacing = width * 0.03;
|
||||||
|
final cardRadius = 18.0;
|
||||||
|
final cardElevation = 0.0;
|
||||||
|
final cardFont = width * 0.045;
|
||||||
|
final cardIcon = width * 0.11;
|
||||||
|
final buttonFont = width * 0.038;
|
||||||
|
final buttonPad = width * 0.03;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: greenBg,
|
backgroundColor: greenBg,
|
||||||
body: Column(
|
body: IndexedStack(
|
||||||
|
index: _selectedIndex,
|
||||||
|
children: [
|
||||||
|
// Dashboard utama
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
// Header
|
||||||
|
Stack(
|
||||||
children: [
|
children: [
|
||||||
// Modern custom header
|
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
|
height: headerHeight,
|
||||||
decoration: const BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
image: DecorationImage(
|
||||||
colors: [greenGradientStart, greenPrimary],
|
image: AssetImage('assets/greenhouse.jpg'),
|
||||||
begin: Alignment.topLeft,
|
fit: BoxFit.cover,
|
||||||
end: Alignment.bottomRight,
|
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: const BorderRadius.only(
|
||||||
bottomLeft: Radius.circular(32),
|
bottomLeft: Radius.circular(32),
|
||||||
bottomRight: Radius.circular(32),
|
bottomRight: Radius.circular(32),
|
||||||
),
|
),
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: cardShadow,
|
|
||||||
blurRadius: 18,
|
|
||||||
offset: Offset(0, 8),
|
|
||||||
),
|
),
|
||||||
],
|
child: Container(
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: size.height * 0.025),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 44,
|
|
||||||
height: 44,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
gradient: LinearGradient(
|
||||||
borderRadius: BorderRadius.circular(12),
|
begin: Alignment.topLeft,
|
||||||
boxShadow: [
|
end: Alignment.bottomRight,
|
||||||
BoxShadow(
|
colors: [
|
||||||
color: Colors.black.withOpacity(0.06),
|
Colors.black.withOpacity(0.5),
|
||||||
blurRadius: 8,
|
Colors.black.withOpacity(0.3),
|
||||||
offset: const Offset(0, 2),
|
Colors.black.withOpacity(0.2),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
|
stops: [0.0, 0.5, 1.0],
|
||||||
),
|
),
|
||||||
child: const Icon(
|
borderRadius: const BorderRadius.only(
|
||||||
Icons.eco,
|
bottomLeft: Radius.circular(32),
|
||||||
color: greenPrimary,
|
bottomRight: Radius.circular(32),
|
||||||
size: 30,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 14),
|
child: Row(
|
||||||
Text(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
'Smart Farming',
|
children: [
|
||||||
style: TextStyle(
|
Padding(
|
||||||
color: Colors.white,
|
padding: EdgeInsets.only(left: 24, top: 24),
|
||||||
fontWeight: FontWeight.bold,
|
child: Column(
|
||||||
fontSize: size.width * 0.065,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
letterSpacing: 1.2,
|
children: [
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: size.height * 0.012),
|
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 18,
|
horizontal: 12,
|
||||||
vertical: 6,
|
vertical: 6,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: yellowBadge.withOpacity(0.85),
|
color: Colors.white.withOpacity(0.15),
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Welcome',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: welcomeFont * 1.1,
|
||||||
|
letterSpacing: 1.2,
|
||||||
|
shadows: [
|
||||||
|
Shadow(
|
||||||
|
offset: Offset(1, 1),
|
||||||
|
blurRadius: 8,
|
||||||
|
color: Colors.black.withOpacity(0.3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 12),
|
||||||
|
Container(
|
||||||
|
width: logoSize,
|
||||||
|
height: logoSize,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.15),
|
||||||
|
blurRadius: 12,
|
||||||
|
offset: Offset(0, 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(
|
||||||
|
sigmaX: 5,
|
||||||
|
sigmaY: 5,
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(logoSize * 0.13),
|
||||||
|
child: Image.asset('assets/logo.png'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
SizedBox(width: logoSize * 0.5),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Jam di luar header card, rata kanan
|
||||||
|
Positioned(
|
||||||
|
right: 24,
|
||||||
|
top: headerHeight - (timeFont * 2.5),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white.withOpacity(0.15),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.white.withOpacity(0.2),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(
|
Icon(
|
||||||
Icons.access_time,
|
Icons.access_time_rounded,
|
||||||
color: greenPrimary,
|
color: Colors.white,
|
||||||
size: 20,
|
size: 18,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 7),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
time,
|
time,
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
color: greenPrimary,
|
color: Colors.white,
|
||||||
fontSize: 18,
|
fontSize: timeFont,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w500,
|
||||||
letterSpacing: 1.1,
|
letterSpacing: 1.1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: size.height * 0.025),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
SizedBox(height: gridPadding),
|
||||||
const Spacer(flex: 2),
|
// Grid 2x2
|
||||||
FadeTransition(
|
Expanded(
|
||||||
opacity: _fadeAnim,
|
child: Padding(
|
||||||
child: Column(
|
padding: EdgeInsets.symmetric(horizontal: gridPadding),
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: GridView.count(
|
||||||
|
crossAxisCount: 2,
|
||||||
|
mainAxisSpacing: gridSpacing,
|
||||||
|
crossAxisSpacing: gridSpacing,
|
||||||
|
childAspectRatio: 1,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
children: [
|
children: [
|
||||||
// Card suhu
|
// Temperature
|
||||||
Container(
|
LayoutBuilder(
|
||||||
width: cardWidth,
|
builder: (context, constraints) {
|
||||||
height: cardHeight,
|
final cardW = constraints.maxWidth;
|
||||||
margin: const EdgeInsets.only(bottom: 18),
|
final cardH = constraints.maxHeight;
|
||||||
|
final iconSize = cardW * 0.22;
|
||||||
|
final labelFont = cardW * 0.10;
|
||||||
|
final valueFont = cardW * 0.12;
|
||||||
|
final pad = cardH * 0.05;
|
||||||
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(borderRadius),
|
borderRadius: BorderRadius.circular(cardRadius),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: cardShadow,
|
color: Colors.black.withOpacity(0.05),
|
||||||
blurRadius: 18,
|
blurRadius: 10,
|
||||||
offset: const Offset(0, 8),
|
offset: Offset(0, 3),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Row(
|
child: ClipRRect(
|
||||||
children: [
|
borderRadius: BorderRadius.circular(cardRadius),
|
||||||
Padding(
|
child: BackdropFilter(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18.0),
|
filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
|
||||||
child: Stack(
|
child: Padding(
|
||||||
alignment: Alignment.topRight,
|
padding: EdgeInsets.all(pad),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
|
padding: EdgeInsets.all(iconSize * 0.18),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: blueTemp.withOpacity(0.15),
|
color: blueTemp.withOpacity(0.1),
|
||||||
borderRadius: BorderRadius.circular(18),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(14),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.thermostat,
|
Icons.thermostat_rounded,
|
||||||
color: blueTemp,
|
color: blueTemp,
|
||||||
size: iconSize,
|
size: iconSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
SizedBox(height: pad * 0.7),
|
||||||
top: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 8,
|
|
||||||
vertical: 2,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: blueTemp,
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: const Text(
|
|
||||||
'°C',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 13,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
Text(
|
||||||
'Temperature',
|
'Temperature',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: blueTemp,
|
fontSize: labelFont,
|
||||||
fontSize: fontSize * 0.95,
|
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${temperature.toStringAsFixed(1)}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: blueTemp,
|
color: blueTemp,
|
||||||
fontSize: fontSize * 1.35,
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: pad * 0.3),
|
||||||
|
Text(
|
||||||
|
'${temperature.toStringAsFixed(1)} °C',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: valueFont,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
color: blueTemp,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 18),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Card kelembapan
|
);
|
||||||
Container(
|
},
|
||||||
width: cardWidth,
|
),
|
||||||
height: cardHeight,
|
// Humidity
|
||||||
margin: const EdgeInsets.only(bottom: 18),
|
LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
final cardW = constraints.maxWidth;
|
||||||
|
final cardH = constraints.maxHeight;
|
||||||
|
final iconSize = cardW * 0.22;
|
||||||
|
final labelFont = cardW * 0.10;
|
||||||
|
final valueFont = cardW * 0.12;
|
||||||
|
final pad = cardH * 0.05;
|
||||||
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(borderRadius),
|
borderRadius: BorderRadius.circular(cardRadius),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: cardShadow,
|
color: Colors.black.withOpacity(0.05),
|
||||||
blurRadius: 18,
|
blurRadius: 10,
|
||||||
offset: const Offset(0, 8),
|
offset: Offset(0, 3),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Row(
|
child: ClipRRect(
|
||||||
children: [
|
borderRadius: BorderRadius.circular(cardRadius),
|
||||||
Padding(
|
child: BackdropFilter(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18.0),
|
filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
|
||||||
child: Stack(
|
child: Padding(
|
||||||
alignment: Alignment.topRight,
|
padding: EdgeInsets.all(pad),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
|
padding: EdgeInsets.all(iconSize * 0.18),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: blueHumidity.withOpacity(0.13),
|
color: blueHumidity.withOpacity(0.1),
|
||||||
borderRadius: BorderRadius.circular(18),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(14),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.water_drop,
|
Icons.water_drop_rounded,
|
||||||
color: blueHumidity,
|
color: blueHumidity,
|
||||||
size: iconSize,
|
size: iconSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
SizedBox(height: pad * 0.7),
|
||||||
top: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 8,
|
|
||||||
vertical: 2,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: blueHumidity,
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: const Text(
|
|
||||||
'%',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 13,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
Text(
|
||||||
'Humidity',
|
'Humidity',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontSize: labelFont,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
color: blueHumidity,
|
color: blueHumidity,
|
||||||
fontSize: fontSize * 0.95,
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: pad * 0.3),
|
||||||
|
Text(
|
||||||
|
'${humidity.toStringAsFixed(1)} %',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: valueFont,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: blueHumidity,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Kipas
|
||||||
|
LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
final cardW = constraints.maxWidth;
|
||||||
|
final cardH = constraints.maxHeight;
|
||||||
|
final iconSize = cardW * 0.22;
|
||||||
|
final labelFont = cardW * 0.10;
|
||||||
|
final valueFont = cardW * 0.12;
|
||||||
|
final pad = cardH * 0.05;
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(cardRadius),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.05),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(cardRadius),
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(pad),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(iconSize * 0.18),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: greenPrimary.withOpacity(0.1),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.ac_unit_rounded,
|
||||||
|
color: greenPrimary,
|
||||||
|
size: iconSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: pad * 0.7),
|
||||||
|
Text(
|
||||||
|
'Kipas',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: labelFont,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: greenPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: pad * 0.5),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
fanOn = !fanOn;
|
||||||
|
_addHistory();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: pad * 1.2,
|
||||||
|
vertical: pad * 0.7,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: fanOn ? greenPrimary : Colors.grey[200],
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: (fanOn ? greenPrimary : Colors.grey[300]!).withOpacity(0.3),
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
fanOn ? 'ON' : 'OFF',
|
||||||
|
style: TextStyle(
|
||||||
|
color: fanOn ? Colors.white : Colors.grey[600],
|
||||||
|
fontSize: labelFont * 0.8,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
|
||||||
'${humidity.toStringAsFixed(1)}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: blueHumidity,
|
|
||||||
fontSize: fontSize * 1.35,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 18),
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Pompa
|
||||||
|
LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
final cardW = constraints.maxWidth;
|
||||||
|
final cardH = constraints.maxHeight;
|
||||||
|
final iconSize = cardW * 0.22;
|
||||||
|
final labelFont = cardW * 0.10;
|
||||||
|
final valueFont = cardW * 0.12;
|
||||||
|
final pad = cardH * 0.05;
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(cardRadius),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.05),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: Offset(0, 3),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
child: ClipRRect(
|
||||||
// Tombol
|
borderRadius: BorderRadius.circular(cardRadius),
|
||||||
Row(
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(pad),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton.icon(
|
Container(
|
||||||
onPressed: () {
|
padding: EdgeInsets.all(iconSize * 0.18),
|
||||||
setState(() {
|
decoration: BoxDecoration(
|
||||||
fanOn = !fanOn;
|
color: greenPrimary.withOpacity(0.1),
|
||||||
});
|
borderRadius: BorderRadius.circular(12),
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.tornado,
|
|
||||||
color: fanOn ? Colors.white : greenPrimary,
|
|
||||||
),
|
),
|
||||||
label: Text(
|
child: Icon(
|
||||||
fanOn ? 'Kipas ON' : 'Kipas OFF',
|
Icons.water_rounded,
|
||||||
|
color: greenPrimary,
|
||||||
|
size: iconSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: pad * 0.7),
|
||||||
|
Text(
|
||||||
|
'Pompa',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: fanOn ? Colors.white : greenPrimary,
|
fontSize: labelFont,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.w600,
|
||||||
|
color: greenPrimary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: ElevatedButton.styleFrom(
|
SizedBox(height: pad * 0.5),
|
||||||
backgroundColor: fanOn ? greenPrimary : Colors.white,
|
GestureDetector(
|
||||||
side: const BorderSide(color: greenPrimary, width: 2),
|
onTap: () {
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(22),
|
|
||||||
),
|
|
||||||
elevation: 0,
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: size.width * 0.09,
|
|
||||||
vertical: size.height * 0.018,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: size.width * 0.06),
|
|
||||||
ElevatedButton.icon(
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
pumpOn = !pumpOn;
|
pumpOn = !pumpOn;
|
||||||
|
_addHistory();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: Icon(
|
child: Container(
|
||||||
Icons.water,
|
|
||||||
color: pumpOn ? Colors.white : greenPrimary,
|
|
||||||
),
|
|
||||||
label: Text(
|
|
||||||
pumpOn ? 'Pompa ON' : 'Pompa OFF',
|
|
||||||
style: TextStyle(
|
|
||||||
color: pumpOn ? Colors.white : greenPrimary,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: pumpOn ? greenPrimary : Colors.white,
|
|
||||||
side: const BorderSide(color: greenPrimary, width: 2),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(22),
|
|
||||||
),
|
|
||||||
elevation: 0,
|
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: size.width * 0.09,
|
horizontal: pad * 1.2,
|
||||||
vertical: size.height * 0.018,
|
vertical: pad * 0.7,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: pumpOn ? greenPrimary : Colors.grey[200],
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: (pumpOn ? greenPrimary : Colors.grey[300]!).withOpacity(0.3),
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
pumpOn ? 'ON' : 'OFF',
|
||||||
|
style: TextStyle(
|
||||||
|
color: pumpOn ? Colors.white : Colors.grey[600],
|
||||||
|
fontSize: labelFont * 0.8,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(flex: 3),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
// History page
|
||||||
|
HistoryPage(history: history),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
bottomNavigationBar: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.05),
|
||||||
|
blurRadius: 15,
|
||||||
|
offset: Offset(0, -5),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||||
|
child: BottomNavigationBar(
|
||||||
|
currentIndex: _selectedIndex,
|
||||||
|
onTap: _onNavTapped,
|
||||||
|
selectedItemColor: greenPrimary,
|
||||||
|
unselectedItemColor: Colors.grey[400],
|
||||||
|
selectedLabelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
unselectedLabelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
items: const [
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.dashboard_rounded),
|
||||||
|
label: 'Home',
|
||||||
|
),
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.history_rounded),
|
||||||
|
label: 'History',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return _buildDashboard(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,244 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class HistoryEntry {
|
||||||
|
final DateTime time;
|
||||||
|
final double temperature;
|
||||||
|
final double humidity;
|
||||||
|
final bool fanOn;
|
||||||
|
final bool pumpOn;
|
||||||
|
HistoryEntry({
|
||||||
|
required this.time,
|
||||||
|
required this.temperature,
|
||||||
|
required this.humidity,
|
||||||
|
required this.fanOn,
|
||||||
|
required this.pumpOn,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class HistoryPage extends StatelessWidget {
|
||||||
|
final List<HistoryEntry> history;
|
||||||
|
const HistoryPage({Key? key, required this.history}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: const Color(0xFFF6FFF9),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
// Modern header dengan background gambar dan overlay gradient
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 110,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('assets/greenhouse.jpg'),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(32),
|
||||||
|
bottomRight: Radius.circular(32),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
Colors.black.withOpacity(0.5),
|
||||||
|
Colors.black.withOpacity(0.3),
|
||||||
|
Colors.black.withOpacity(0.2),
|
||||||
|
],
|
||||||
|
stops: [0.0, 0.5, 1.0],
|
||||||
|
),
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(32),
|
||||||
|
bottomRight: Radius.circular(32),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.history_rounded, color: Colors.white, size: 32),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Text(
|
||||||
|
'Riwayat Data',
|
||||||
|
style: theme.textTheme.titleLarge?.copyWith(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 26,
|
||||||
|
letterSpacing: 1.2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 18),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
|
child:
|
||||||
|
history.isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Text(
|
||||||
|
'Belum ada riwayat data',
|
||||||
|
style: TextStyle(fontSize: 16, color: Colors.grey),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Card(
|
||||||
|
elevation: 6,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(22),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: DataTable(
|
||||||
|
headingRowColor: MaterialStateProperty.all(
|
||||||
|
const Color(0xFFE8F5E9),
|
||||||
|
),
|
||||||
|
headingTextStyle: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xFF1CB56B),
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
dataRowColor: MaterialStateProperty.resolveWith<
|
||||||
|
Color?
|
||||||
|
>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.green.withOpacity(0.15);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
columns: const [
|
||||||
|
DataColumn(label: Text('Waktu')),
|
||||||
|
DataColumn(label: Text('Temperature')),
|
||||||
|
DataColumn(label: Text('Humidity')),
|
||||||
|
DataColumn(label: Text('Kipas')),
|
||||||
|
DataColumn(label: Text('Pompa')),
|
||||||
|
],
|
||||||
|
rows: List.generate(history.length, (i) {
|
||||||
|
final h = history[history.length - 1 - i];
|
||||||
|
final isEven = i % 2 == 0;
|
||||||
|
return DataRow(
|
||||||
|
color: MaterialStateProperty.all(
|
||||||
|
isEven
|
||||||
|
? Colors.white
|
||||||
|
: const Color(0xFFF1F8E9),
|
||||||
|
),
|
||||||
|
cells: [
|
||||||
|
DataCell(
|
||||||
|
Text(
|
||||||
|
'${h.time.hour.toString().padLeft(2, '0')}:${h.time.minute.toString().padLeft(2, '0')}:${h.time.second.toString().padLeft(2, '0')}\n${h.time.day}/${h.time.month}/${h.time.year}',
|
||||||
|
style: const TextStyle(fontSize: 13),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.thermostat,
|
||||||
|
color: Color(0xFF4FC3F7),
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
'${h.temperature.toStringAsFixed(1)} °C',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.water_drop,
|
||||||
|
color: Color(0xFF0288D1),
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
'${h.humidity.toStringAsFixed(1)} %',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
h.fanOn
|
||||||
|
? const Color(0xFFB9F6CA)
|
||||||
|
: const Color(0xFFFFCDD2),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
h.fanOn ? 'ON' : 'OFF',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color:
|
||||||
|
h.fanOn
|
||||||
|
? Colors.green[800]
|
||||||
|
: Colors.red[800],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
h.pumpOn
|
||||||
|
? const Color(0xFFB9F6CA)
|
||||||
|
: const Color(0xFFFFCDD2),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
h.pumpOn ? 'ON' : 'OFF',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color:
|
||||||
|
h.pumpOn
|
||||||
|
? Colors.green[800]
|
||||||
|
: Colors.red[800],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,17 +19,16 @@ class _SplashScreenState extends State<SplashScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final size = MediaQuery.of(context).size;
|
final size = MediaQuery.of(context).size;
|
||||||
final logoSize = size.width * 0.3;
|
final logoSize = size.width * 0.23;
|
||||||
final borderRadius = size.width * 0.08;
|
final borderRadius = size.width * 0.07;
|
||||||
final fontSize = size.width * 0.08;
|
final textSizeFrom = size.width * 0.025;
|
||||||
final progressSize = size.width * 0.1;
|
final textSizePolije = size.width * 0.028;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
body: Center(
|
body: Stack(
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Center(
|
||||||
|
child: Container(
|
||||||
width: logoSize,
|
width: logoSize,
|
||||||
height: logoSize,
|
height: logoSize,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
@ -41,24 +40,38 @@ class _SplashScreenState extends State<SplashScreen> {
|
||||||
child: Image.asset('assets/logo.png'),
|
child: Image.asset('assets/logo.png'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: size.height * 0.03),
|
),
|
||||||
|
Positioned(
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: size.height * 0.06,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Smart Farm',
|
'from',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: fontSize,
|
fontSize: textSizeFrom,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
SizedBox(height: size.height * 0.006),
|
||||||
|
Text(
|
||||||
|
'Politeknik Negeri Jember',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: textSizePolije,
|
||||||
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Colors.green,
|
letterSpacing: 1.1,
|
||||||
),
|
),
|
||||||
),
|
textAlign: TextAlign.center,
|
||||||
SizedBox(height: size.height * 0.04),
|
|
||||||
SizedBox(
|
|
||||||
width: progressSize,
|
|
||||||
height: progressSize,
|
|
||||||
child: const CircularProgressIndicator(color: Colors.green),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ name: smart_farm
|
||||||
description: "A new Flutter project."
|
description: "A new Flutter project."
|
||||||
# The following line prevents the package from being accidentally published to
|
# The following line prevents the package from being accidentally published to
|
||||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
# The following defines the version and build number for your application.
|
# The following defines the version and build number for your application.
|
||||||
# A version number is three numbers separated by dots, like 1.2.43
|
# A version number is three numbers separated by dots, like 1.2.43
|
||||||
|
@ -51,7 +51,6 @@ dev_dependencies:
|
||||||
|
|
||||||
# The following section is specific to Flutter packages.
|
# The following section is specific to Flutter packages.
|
||||||
flutter:
|
flutter:
|
||||||
|
|
||||||
# The following line ensures that the Material Icons font is
|
# The following line ensures that the Material Icons font is
|
||||||
# included with your application, so that you can use the icons in
|
# included with your application, so that you can use the icons in
|
||||||
# the material Icons class.
|
# the material Icons class.
|
||||||
|
@ -60,6 +59,7 @@ flutter:
|
||||||
# To add assets to your application, add an assets section, like this:
|
# To add assets to your application, add an assets section, like this:
|
||||||
assets:
|
assets:
|
||||||
- assets/logo.png
|
- assets/logo.png
|
||||||
|
- assets/greenhouse.jpg
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/to/resolution-aware-images
|
# https://flutter.dev/to/resolution-aware-images
|
||||||
|
|
Loading…
Reference in New Issue