Perbarui sintaks Dart dan perbaiki opacity warna

- Ganti `Key? key` dengan `super.key` di berbagai tampilan
- Gunakan `withAlpha()` sebagai pengganti `withOpacity()` untuk transparansi warna
- Lakukan penyesuaian kecil pada tata letak dan styling komponen
- Hapus impor yang tidak digunakan
- Sederhanakan beberapa bagian kode dashboard
This commit is contained in:
Khafidh Fuadi
2025-03-08 14:13:59 +07:00
parent 02711a512f
commit 9690764cf4
6 changed files with 58 additions and 72 deletions

View File

@ -2,10 +2,9 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:penyaluran_app/app/modules/auth/controllers/auth_controller.dart'; import 'package:penyaluran_app/app/modules/auth/controllers/auth_controller.dart';
import 'package:penyaluran_app/app/routes/app_pages.dart';
class LoginView extends GetView<AuthController> { class LoginView extends GetView<AuthController> {
const LoginView({Key? key}) : super(key: key); const LoginView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:penyaluran_app/app/modules/dashboard/controllers/dashboard_controller.dart'; import 'package:penyaluran_app/app/modules/dashboard/controllers/dashboard_controller.dart';
class DonaturDashboardView extends GetView<DashboardController> { class DonaturDashboardView extends GetView<DashboardController> {
const DonaturDashboardView({Key? key}) : super(key: key); const DonaturDashboardView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -145,8 +145,8 @@ class DonaturDashboardView extends GetView<DashboardController> {
onPressed: () { onPressed: () {
// Navigasi ke halaman penitipan bantuan baru // Navigasi ke halaman penitipan bantuan baru
}, },
child: const Icon(Icons.add),
tooltip: 'Titipkan Bantuan Baru', tooltip: 'Titipkan Bantuan Baru',
child: const Icon(Icons.add),
), ),
); );
} }
@ -187,7 +187,7 @@ class DonaturDashboardView extends GetView<DashboardController> {
Container( Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.1), color: color.withAlpha(26),
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
child: Icon( child: Icon(

View File

@ -5,20 +5,20 @@ import 'package:penyaluran_app/app/modules/dashboard/controllers/dashboard_contr
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
class PetugasDesaDashboardView extends GetView<DashboardController> { class PetugasDesaDashboardView extends GetView<DashboardController> {
const PetugasDesaDashboardView({Key? key}) : super(key: key); const PetugasDesaDashboardView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final TextTheme textTheme = final TextTheme textTheme =
GoogleFonts.dmSansTextTheme(Theme.of(context).textTheme); GoogleFonts.dmSansTextTheme(Theme.of(context).textTheme);
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
return Theme( return Theme(
data: Theme.of(context).copyWith( data: Theme.of(context).copyWith(
textTheme: textTheme, textTheme: textTheme,
), ),
child: Scaffold( child: Scaffold(
key: _scaffoldKey, key: scaffoldKey,
drawer: Drawer( drawer: Drawer(
child: ListView( child: ListView(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -67,7 +67,6 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
'assets/icons/home-icon.svg', 'assets/icons/home-icon.svg',
width: 24, width: 24,
height: 24, height: 24,
color: Colors.grey[700],
), ),
title: const Text('Beranda'), title: const Text('Beranda'),
onTap: () { onTap: () {
@ -120,7 +119,7 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
children: [ children: [
// add drawer button // add drawer button
IconButton( IconButton(
onPressed: () => _scaffoldKey.currentState?.openDrawer(), onPressed: () => scaffoldKey.currentState?.openDrawer(),
icon: const Icon(Icons.menu), icon: const Icon(Icons.menu),
), ),
// Header dengan greeting // Header dengan greeting
@ -221,7 +220,7 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.1), color: Colors.grey.withAlpha(26), // 0.1 * 255 ≈ 26
spreadRadius: 1, spreadRadius: 1,
blurRadius: 3, blurRadius: 3,
offset: const Offset(0, 1), offset: const Offset(0, 1),
@ -277,7 +276,7 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
title, title,
style: textTheme.bodyMedium?.copyWith( style: textTheme.bodyMedium?.copyWith(
fontSize: 14, fontSize: 14,
color: Colors.white.withOpacity(0.8), color: Colors.white.withAlpha(204), // 0.8 * 255 ≈ 204
), ),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
@ -341,7 +340,7 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
title, title,
style: textTheme.bodyMedium?.copyWith( style: textTheme.bodyMedium?.copyWith(
fontSize: 14, fontSize: 14,
color: Colors.white.withOpacity(0.8), color: Colors.white.withAlpha(204), // 0.8 * 255 ≈ 204
), ),
), ),
Text( Text(
@ -366,60 +365,48 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
} }
Widget _buildProgressSection(TextTheme textTheme) { Widget _buildProgressSection(TextTheme textTheme) {
return Container( return Column(
padding: const EdgeInsets.all(16), crossAxisAlignment: CrossAxisAlignment.start,
decoration: BoxDecoration( children: [
gradient: const LinearGradient( Text(
begin: Alignment.topLeft, 'Progress Penyaluran',
end: Alignment.bottomRight, style: textTheme.titleMedium?.copyWith(
colors: [Color(0xFF2E5077), Color(0xFF5882B1)], fontSize: 16,
transform: GradientRotation(96.93 * 3.14159 / 180), fontWeight: FontWeight.bold,
),
), ),
borderRadius: BorderRadius.circular(12), const SizedBox(height: 10),
), ClipRRect(
child: Column( borderRadius: BorderRadius.circular(8),
crossAxisAlignment: CrossAxisAlignment.start, child: LinearProgressIndicator(
children: [ value: 0.7,
Text( minHeight: 10,
'Progress Penyaluran', backgroundColor: Colors.grey[300],
style: textTheme.bodyMedium?.copyWith( valueColor: const AlwaysStoppedAnimation<Color>(Color(0xFF2E5077)),
fontSize: 14,
color: Colors.white.withOpacity(0.8),
),
), ),
const SizedBox(height: 10), ),
ClipRRect( const SizedBox(height: 10),
borderRadius: BorderRadius.circular(8), Text(
child: LinearProgressIndicator( '70% Selesai',
value: 0.7, style: textTheme.bodyMedium?.copyWith(
minHeight: 10, fontSize: 14,
backgroundColor: Colors.white.withOpacity(0.3), fontWeight: FontWeight.bold,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.white), color: const Color(0xFF2E5077),
),
), ),
const SizedBox(height: 10), ),
Text( const SizedBox(height: 10),
'70% Selesai', _buildProgressDetailRow('Telah Menerima', 70, textTheme),
style: textTheme.bodyMedium?.copyWith( _buildProgressDetailRow('Dijedwalkan', 20, textTheme),
fontSize: 16, _buildProgressDetailRow('Belum Dijadwalkan', 10, textTheme),
fontWeight: FontWeight.bold, const SizedBox(height: 5),
color: Colors.white, Text(
), 'Total : 100 Penerima, Telah Disalurkan : 70 Penerima, Belum Disalurkan : 30',
style: textTheme.bodySmall?.copyWith(
fontSize: 12,
color: Colors.grey[600],
), ),
const SizedBox(height: 10), ),
_buildProgressDetailRow('Telah Menerima', 70, textTheme), ],
_buildProgressDetailRow('Dijedwalkan', 20, textTheme),
_buildProgressDetailRow('Belum Dijadwalkan', 10, textTheme),
const SizedBox(height: 5),
Text(
'Total : 100 Penerima, Telah Disalurkan : 70 Penerima, Belum Disalurkan : 30',
style: textTheme.bodySmall?.copyWith(
fontSize: 12,
color: Colors.white.withOpacity(0.8),
),
),
],
),
); );
} }
@ -455,7 +442,7 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
0.7 * 0.7 *
(value / 100), (value / 100),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFFE4F1AC), color: const Color(0xFF2E5077),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
), ),
@ -552,7 +539,7 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.1), color: Colors.grey.withAlpha(26), // 0.1 * 255 ≈ 26
spreadRadius: 1, spreadRadius: 1,
blurRadius: 3, blurRadius: 3,
offset: const Offset(0, 1), offset: const Offset(0, 1),
@ -662,7 +649,7 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.1), color: Colors.grey.withAlpha(26), // 0.1 * 255 ≈ 26
spreadRadius: 1, spreadRadius: 1,
blurRadius: 3, blurRadius: 3,
offset: const Offset(0, 1), offset: const Offset(0, 1),
@ -686,7 +673,7 @@ class PetugasDesaDashboardView extends GetView<DashboardController> {
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.green.withOpacity(0.1), color: Colors.green.withAlpha(26), // 0.1 * 255 ≈ 26
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
child: Text( child: Text(

View File

@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:penyaluran_app/app/modules/dashboard/controllers/dashboard_controller.dart'; import 'package:penyaluran_app/app/modules/dashboard/controllers/dashboard_controller.dart';
class PetugasVerifikasiDashboardView extends GetView<DashboardController> { class PetugasVerifikasiDashboardView extends GetView<DashboardController> {
const PetugasVerifikasiDashboardView({Key? key}) : super(key: key); const PetugasVerifikasiDashboardView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -174,7 +174,7 @@ class PetugasVerifikasiDashboardView extends GetView<DashboardController> {
Container( Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.1), color: color.withAlpha(26),
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
child: Icon( child: Icon(

View File

@ -4,7 +4,7 @@ import 'package:penyaluran_app/app/modules/dashboard/controllers/dashboard_contr
import 'package:penyaluran_app/app/modules/auth/controllers/auth_controller.dart'; import 'package:penyaluran_app/app/modules/auth/controllers/auth_controller.dart';
class WargaDashboardView extends GetView<DashboardController> { class WargaDashboardView extends GetView<DashboardController> {
const WargaDashboardView({Key? key}) : super(key: key); const WargaDashboardView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -253,7 +253,7 @@ class WargaDashboardView extends GetView<DashboardController> {
Container( Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.1), color: color.withAlpha(26),
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
child: Icon( child: Icon(

View File

@ -3,7 +3,7 @@ import 'package:get/get.dart';
import 'package:penyaluran_app/app/modules/home/controllers/home_controller.dart'; import 'package:penyaluran_app/app/modules/home/controllers/home_controller.dart';
class HomeView extends GetView<HomeController> { class HomeView extends GetView<HomeController> {
const HomeView({Key? key}) : super(key: key); const HomeView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {