data sync page

This commit is contained in:
efrilm
2025-09-20 04:45:08 +07:00
parent 5b980d237f
commit 72a464b4c0
2 changed files with 85 additions and 50 deletions
@@ -87,20 +87,15 @@ class _DataSyncPageState extends State<DataSyncPage>
);
}
// Portrait layout (original)
// Portrait layout
Widget _buildPortraitLayout(DataSyncState state, double screenHeight) {
return Padding(
padding: EdgeInsets.all(24),
child: Column(
children: [
SizedBox(height: screenHeight * 0.08), // Responsive spacing
// Header
_buildHeader(false),
SizedBox(height: screenHeight * 0.08),
// Sync progress
_buildHeader(false),
SizedBox(height: screenHeight * 0.08),
Expanded(
child: state.when(
initial: () => _buildInitialState(false),
@@ -110,24 +105,20 @@ class _DataSyncPageState extends State<DataSyncPage>
error: (message) => _buildErrorState(message, false),
),
),
SizedBox(height: 20),
// Actions
_buildActions(state),
],
),
);
}
// Landscape layout (side by side)
// Landscape layout
Widget _buildLandscapeLayout(
DataSyncState state, double screenWidth, double screenHeight) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 32, vertical: 16),
child: Row(
children: [
// Left side - Header and info
Expanded(
flex: 2,
child: Column(
@@ -139,10 +130,7 @@ class _DataSyncPageState extends State<DataSyncPage>
],
),
),
SizedBox(width: 40),
// Right side - Sync progress
Expanded(
flex: 3,
child: Container(
@@ -188,7 +176,7 @@ class _DataSyncPageState extends State<DataSyncPage>
),
SizedBox(height: isLandscape ? 4 : 8),
Text(
'Mengunduh data terbaru ke perangkat',
'Mengunduh kategori dan produk terbaru',
style: TextStyle(
fontSize: isLandscape ? 14 : 16,
color: Colors.grey.shade600,
@@ -319,8 +307,8 @@ class _DataSyncPageState extends State<DataSyncPage>
Widget _buildStepIndicator(SyncStep currentStep, bool isLandscape) {
final steps = [
('Produk', SyncStep.products, Icons.inventory_2),
('Kategori', SyncStep.categories, Icons.category),
('Produk', SyncStep.products, Icons.inventory_2),
('Variant', SyncStep.variants, Icons.tune),
('Selesai', SyncStep.completed, Icons.check_circle),
];
@@ -551,11 +539,11 @@ class _DataSyncPageState extends State<DataSyncPage>
// Vertical layout for landscape
Column(
children: [
_buildStatItem('Produk', '${stats.totalProducts}',
Icons.inventory_2, Colors.blue, isLandscape),
SizedBox(height: 8),
_buildStatItem('Kategori', '${stats.totalCategories}',
Icons.category, Colors.green, isLandscape),
Icons.category, Colors.blue, isLandscape),
SizedBox(height: 8),
_buildStatItem('Produk', '${stats.totalProducts}',
Icons.inventory_2, Colors.green, isLandscape),
SizedBox(height: 8),
_buildStatItem('Variant', '${stats.totalVariants}',
Icons.tune, Colors.orange, isLandscape),
@@ -566,10 +554,10 @@ class _DataSyncPageState extends State<DataSyncPage>
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildStatItem('Produk', '${stats.totalProducts}',
Icons.inventory_2, Colors.blue, isLandscape),
_buildStatItem('Kategori', '${stats.totalCategories}',
Icons.category, Colors.green, isLandscape),
Icons.category, Colors.blue, isLandscape),
_buildStatItem('Produk', '${stats.totalProducts}',
Icons.inventory_2, Colors.green, isLandscape),
_buildStatItem('Variant', '${stats.totalVariants}',
Icons.tune, Colors.orange, isLandscape),
],
@@ -765,10 +753,10 @@ class _DataSyncPageState extends State<DataSyncPage>
IconData _getSyncIcon(SyncStep step) {
switch (step) {
case SyncStep.products:
return Icons.inventory_2;
case SyncStep.categories:
return Icons.category;
case SyncStep.products:
return Icons.inventory_2;
case SyncStep.variants:
return Icons.tune;
case SyncStep.completed:
@@ -778,10 +766,10 @@ class _DataSyncPageState extends State<DataSyncPage>
String _getStepLabel(SyncStep step) {
switch (step) {
case SyncStep.products:
return 'Mengunduh Produk';
case SyncStep.categories:
return 'Mengunduh Kategori';
case SyncStep.products:
return 'Mengunduh Produk';
case SyncStep.variants:
return 'Mengunduh Variant';
case SyncStep.completed: