Compare commits
2 Commits
1023249592
...
a95bc5f18a
| Author | SHA1 | Date |
|---|---|---|
|
|
a95bc5f18a | |
|
|
51ae862394 |
|
|
@ -4,7 +4,7 @@
|
||||||
# This file should be version controlled and should not be manually edited.
|
# This file should be version controlled and should not be manually edited.
|
||||||
|
|
||||||
version:
|
version:
|
||||||
revision: "db50e20168db8fee486b9abf32fc912de3bc5b6a"
|
revision: "ad70ec4617166f1c38e5d2bfd388af71fda14f06"
|
||||||
channel: "stable"
|
channel: "stable"
|
||||||
|
|
||||||
project_type: app
|
project_type: app
|
||||||
|
|
@ -13,11 +13,11 @@ project_type: app
|
||||||
migration:
|
migration:
|
||||||
platforms:
|
platforms:
|
||||||
- platform: root
|
- platform: root
|
||||||
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
|
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
|
||||||
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
|
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
|
||||||
- platform: android
|
- platform: android
|
||||||
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
|
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
|
||||||
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
|
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
|
||||||
|
|
||||||
# User provided section
|
# User provided section
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("kotlin-android")
|
|
||||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||||
id("dev.flutter.flutter-gradle-plugin")
|
id("dev.flutter.flutter-gradle-plugin")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,6 @@
|
||||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
# This builtInKotlin flag was added automatically by Flutter migrator
|
||||||
|
android.builtInKotlin=true
|
||||||
|
# This newDsl flag was added automatically by Flutter migrator
|
||||||
|
android.newDsl=true
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,38 @@ class MobileShell extends StatefulWidget {
|
||||||
class _MobileShellState extends State<MobileShell> {
|
class _MobileShellState extends State<MobileShell> {
|
||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
|
|
||||||
|
/// Dashboard controller is created once and reused across rebuilds to avoid
|
||||||
|
/// re-triggering data loads on every [setState] call (e.g. tab switches).
|
||||||
|
late DashboardController _dashboardController;
|
||||||
|
|
||||||
static const _titles = ['Dashboard', 'Inventory', 'Products', 'Orders', 'More'];
|
static const _titles = ['Dashboard', 'Inventory', 'Products', 'Orders', 'More'];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
// Initialise the controller here (not in initState) because it needs
|
||||||
|
// KcAppScope which requires an inherited widget lookup.
|
||||||
|
if (!_dashboardControllerInitialised) {
|
||||||
|
final services = KcAppScope.of<MobileAppServices>(context);
|
||||||
|
_dashboardController = DashboardController(
|
||||||
|
GetDashboardSummary(
|
||||||
|
inventoryRepository: services.inventoryRepository,
|
||||||
|
productPublishingRepository: services.productPublishingRepository,
|
||||||
|
ordersRepository: services.ordersRepository,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
_dashboardControllerInitialised = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _dashboardControllerInitialised = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_dashboardController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final config = KcAppScope.configOf<MobileAppServices>(context);
|
final config = KcAppScope.configOf<MobileAppServices>(context);
|
||||||
|
|
@ -86,15 +116,7 @@ class _MobileShellState extends State<MobileShell> {
|
||||||
|
|
||||||
switch (_selectedIndex) {
|
switch (_selectedIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return MobileDashboardPage(
|
return MobileDashboardPage(controller: _dashboardController);
|
||||||
controller: DashboardController(
|
|
||||||
GetDashboardSummary(
|
|
||||||
inventoryRepository: services.inventoryRepository,
|
|
||||||
productPublishingRepository: services.productPublishingRepository,
|
|
||||||
ordersRepository: services.ordersRepository,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case 1:
|
case 1:
|
||||||
return MobileInventoryPage(
|
return MobileInventoryPage(
|
||||||
repository: services.inventoryRepository,
|
repository: services.inventoryRepository,
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,20 @@ class KcSummaryCard extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(icon, color: iconColor, size: 28),
|
Icon(icon, color: iconColor, size: 22),
|
||||||
const SizedBox(height: KcSpacing.sm),
|
|
||||||
Text(value, style: theme.textTheme.headlineMedium?.copyWith(fontSize: 32)),
|
|
||||||
const SizedBox(height: KcSpacing.xs),
|
const SizedBox(height: KcSpacing.xs),
|
||||||
Text(label, style: theme.textTheme.bodyMedium?.copyWith(color: KcColors.neutral)),
|
FittedBox(
|
||||||
|
fit: BoxFit.scaleDown,
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(value, style: theme.textTheme.headlineMedium?.copyWith(fontSize: 28)),
|
||||||
|
),
|
||||||
|
const SizedBox(height: KcSpacing.xs),
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: theme.textTheme.bodySmall?.copyWith(color: KcColors.neutral),
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue