Compare commits

..

No commits in common. "a95bc5f18a629b7ef82d478ba0e752aa7e709fdd" and "10232495925f8a6f929e7397a4f67e0421213983" have entirely different histories.

5 changed files with 19 additions and 53 deletions

View File

@ -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: "ad70ec4617166f1c38e5d2bfd388af71fda14f06" revision: "db50e20168db8fee486b9abf32fc912de3bc5b6a"
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: ad70ec4617166f1c38e5d2bfd388af71fda14f06 create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
- platform: android - platform: android
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
# User provided section # User provided section

View File

@ -1,5 +1,6 @@
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")
} }

View File

@ -1,6 +1,2 @@
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

View File

@ -30,38 +30,8 @@ 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);
@ -116,7 +86,15 @@ class _MobileShellState extends State<MobileShell> {
switch (_selectedIndex) { switch (_selectedIndex) {
case 0: case 0:
return MobileDashboardPage(controller: _dashboardController); return MobileDashboardPage(
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,

View File

@ -36,20 +36,11 @@ class KcSummaryCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon(icon, color: iconColor, size: 22), Icon(icon, color: iconColor, size: 28),
const SizedBox(height: KcSpacing.sm),
Text(value, style: theme.textTheme.headlineMedium?.copyWith(fontSize: 32)),
const SizedBox(height: KcSpacing.xs), const SizedBox(height: KcSpacing.xs),
FittedBox( Text(label, style: theme.textTheme.bodyMedium?.copyWith(color: KcColors.neutral)),
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,
),
], ],
), ),
); );