const constructure

This commit is contained in:
Efril
2026-03-01 20:02:12 +07:00
parent 5058f99fe0
commit e625bd3d2a
142 changed files with 817 additions and 760 deletions
+17 -17
View File
@@ -22,7 +22,7 @@ class SyncPage extends StatefulWidget implements AutoRouteWrapper {
@override
Widget wrappedRoute(BuildContext context) => BlocProvider(
create: (context) => getIt<SyncBloc>()..add(SyncEvent.startSync()),
create: (context) => getIt<SyncBloc>()..add(const SyncEvent.startSync()),
child: this,
);
}
@@ -35,7 +35,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
void initState() {
super.initState();
_animationController = AnimationController(
duration: Duration(milliseconds: 500),
duration: const Duration(milliseconds: 500),
vsync: this,
);
_progressAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
@@ -66,7 +66,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
// Tunggu sebentar lalu pindah ke dashboard
Future.delayed(const Duration(seconds: 2), () {
context.router.replace(MainRoute());
context.router.replace(const MainRoute());
});
}
// Kalau error
@@ -76,7 +76,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
},
builder: (context, state) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 32, vertical: 16),
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
child: Row(
children: [
Expanded(
@@ -85,13 +85,13 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildHeader(),
SizedBox(height: 20),
const SizedBox(height: 20),
_buildActions(state),
],
),
),
SpaceWidth(40),
SizedBox(width: 40),
const SpaceWidth(40),
const SizedBox(width: 40),
Expanded(
flex: 3,
child: SizedBox(
@@ -119,7 +119,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
}
// Kondisi default: initial
return SyncInitialWidget();
return const SyncInitialWidget();
},
),
),
@@ -138,7 +138,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.error_outline, size: 48, color: Colors.red.shade400),
SizedBox(height: 12),
const SizedBox(height: 12),
Text(
'Sinkronisasi Gagal',
style: TextStyle(
@@ -147,9 +147,9 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
color: Colors.red.shade600,
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Container(
padding: EdgeInsets.all(12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.red.shade50,
borderRadius: BorderRadius.circular(8),
@@ -160,7 +160,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
textAlign: TextAlign.center,
),
),
SizedBox(height: 12),
const SizedBox(height: 12),
Text(
'Periksa koneksi internet dan coba lagi',
style: TextStyle(fontSize: 12, color: Colors.grey.shade600),
@@ -180,9 +180,9 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
color: AppColor.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(15),
),
child: Icon(Icons.sync, size: 30, color: AppColor.primary),
child: const Icon(Icons.sync, size: 30, color: AppColor.primary),
),
SizedBox(height: 12),
const SizedBox(height: 12),
Text(
'Sinkronisasi Data',
style: TextStyle(
@@ -191,7 +191,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
color: Colors.grey.shade800,
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Text(
'Mengunduh kategori dan produk terbaru',
style: TextStyle(fontSize: 16, color: Colors.grey.shade600),
@@ -215,7 +215,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
if (state.stats != null && state.errorMessage == null) {
return AppElevatedButton.filled(
onPressed: () {
context.router.replace(MainRoute());
context.router.replace(const MainRoute());
},
label: 'Lanjutkan ke Aplikasi',
);
@@ -228,7 +228,7 @@ class _SyncPageState extends State<SyncPage> with TickerProviderStateMixin {
Expanded(
child: AppElevatedButton.outlined(
onPressed: () {
context.router.replace(MainRoute());
context.router.replace(const MainRoute());
},
label: 'Lewati',
),
@@ -27,7 +27,7 @@ class SyncCompletedWidget extends StatelessWidget {
),
),
SizedBox(height: 20),
const SizedBox(height: 20),
Text(
'Sinkronisasi Berhasil!',
@@ -38,18 +38,18 @@ class SyncCompletedWidget extends StatelessWidget {
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Text(
'Data berhasil diunduh ke perangkat',
style: TextStyle(fontSize: 14, color: Colors.grey.shade600),
),
SizedBox(height: 20),
const SizedBox(height: 20),
// Stats cards
Container(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
@@ -65,7 +65,7 @@ class SyncCompletedWidget extends StatelessWidget {
color: Colors.grey.shade700,
),
),
SizedBox(height: 12),
const SizedBox(height: 12),
Column(
children: [
_buildStatItem(
@@ -74,14 +74,14 @@ class SyncCompletedWidget extends StatelessWidget {
Icons.category,
Colors.blue,
),
SizedBox(height: 8),
const SizedBox(height: 8),
_buildStatItem(
'Produk',
'${stats.totalProducts}',
Icons.inventory_2,
Colors.green,
),
SizedBox(height: 8),
const SizedBox(height: 8),
_buildStatItem(
'Variant',
'${stats.totalVariants}',
@@ -94,10 +94,10 @@ class SyncCompletedWidget extends StatelessWidget {
),
),
SizedBox(height: 12),
const SizedBox(height: 12),
Container(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color: Colors.grey.shade100,
borderRadius: BorderRadius.circular(6),
@@ -119,7 +119,7 @@ class SyncCompletedWidget extends StatelessWidget {
Color color,
) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: color.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
@@ -128,7 +128,7 @@ class SyncCompletedWidget extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: 20, color: color),
SizedBox(width: 8),
const SizedBox(width: 8),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -11,12 +11,12 @@ class SyncInitialWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.download_rounded, size: 48, color: Colors.grey.shade400),
SizedBox(height: 12),
const SizedBox(height: 12),
Text(
'Siap untuk sinkronisasi',
style: AppStyle.lg.copyWith(fontWeight: FontWeight.w500),
),
SizedBox(height: 4),
const SizedBox(height: 4),
Text(
'Tekan tombol mulai untuk mengunduh data',
style: AppStyle.sm.copyWith(color: Colors.grey.shade600),
@@ -36,7 +36,7 @@ class SyncStateWidget extends StatelessWidget {
value: progressAnimation.value,
strokeWidth: 6,
backgroundColor: Colors.grey.shade200,
valueColor: AlwaysStoppedAnimation<Color>(
valueColor: const AlwaysStoppedAnimation<Color>(
AppColor.primary,
),
);
@@ -46,13 +46,13 @@ class SyncStateWidget extends StatelessWidget {
Column(
children: [
Icon(_getSyncIcon(step), size: 24, color: AppColor.primary),
SizedBox(height: 2),
const SizedBox(height: 2),
AnimatedBuilder(
animation: progressAnimation,
builder: (context, child) {
return Text(
'${(progressAnimation.value * 100).toInt()}%',
style: TextStyle(
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: AppColor.primary,
@@ -65,16 +65,16 @@ class SyncStateWidget extends StatelessWidget {
],
),
SizedBox(height: 20),
const SizedBox(height: 20),
// Step indicator
_buildStepIndicator(step),
SizedBox(height: 12),
const SizedBox(height: 12),
// Current message
Container(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: BoxDecoration(
color: Colors.blue.shade50,
borderRadius: BorderRadius.circular(8),
@@ -90,7 +90,7 @@ class SyncStateWidget extends StatelessWidget {
),
),
SizedBox(height: 12),
const SizedBox(height: 12),
// Sync details
_buildSyncDetails(step, progress),
@@ -101,7 +101,7 @@ class SyncStateWidget extends StatelessWidget {
Widget _buildSyncDetails(SyncStep step, double progress) {
return Container(
padding: EdgeInsets.all(12),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
@@ -122,7 +122,7 @@ class SyncStateWidget extends StatelessWidget {
),
Text(
_getStepLabel(step),
style: TextStyle(
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: AppColor.primary,
@@ -130,7 +130,7 @@ class SyncStateWidget extends StatelessWidget {
),
],
),
SizedBox(height: 6),
const SizedBox(height: 6),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -144,7 +144,7 @@ class SyncStateWidget extends StatelessWidget {
),
Text(
'${(progress * 100).toInt()}%',
style: TextStyle(
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: AppColor.primary,
@@ -172,8 +172,8 @@ class SyncStateWidget extends StatelessWidget {
final isCompleted = step.index < currentStep.index;
return Container(
margin: EdgeInsets.symmetric(vertical: 2),
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
margin: const EdgeInsets.symmetric(vertical: 2),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: isActive
? AppColor.primary.withOpacity(0.1)
@@ -194,7 +194,7 @@ class SyncStateWidget extends StatelessWidget {
? Colors.green.shade600
: Colors.grey.shade500,
),
SizedBox(width: 4),
const SizedBox(width: 4),
Text(
label,
style: TextStyle(