added categories, import export, settings
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/// A user-defined supermarket with a display color.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Supermarket {
|
||||
const Supermarket({
|
||||
this.id,
|
||||
required this.name,
|
||||
required this.colorValue,
|
||||
this.sortOrder = 0,
|
||||
});
|
||||
|
||||
final int? id;
|
||||
final String name;
|
||||
final int colorValue;
|
||||
final int sortOrder;
|
||||
|
||||
Color get color => Color(colorValue);
|
||||
|
||||
factory Supermarket.fromMap(Map<String, Object?> map) {
|
||||
return Supermarket(
|
||||
id: map['id'] as int?,
|
||||
name: map['name']! as String,
|
||||
colorValue: map['color']! as int,
|
||||
sortOrder: map['sort_order'] as int? ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
Supermarket copyWith({
|
||||
int? id,
|
||||
String? name,
|
||||
int? colorValue,
|
||||
int? sortOrder,
|
||||
}) {
|
||||
return Supermarket(
|
||||
id: id ?? this.id,
|
||||
name: name ?? this.name,
|
||||
colorValue: colorValue ?? this.colorValue,
|
||||
sortOrder: sortOrder ?? this.sortOrder,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Palette offered when the user picks a store color.
|
||||
const List<int> kStoreColorPalette = [
|
||||
0xFFEEC21B, // Jumbo yellow
|
||||
0xFF0050AA, // Lidl blue
|
||||
0xFF00A0E2, // AH blue
|
||||
0xFF00205B, // Aldi navy
|
||||
0xFF6EC31E, // Plus green
|
||||
0xFFE30613, // Dirk / Coop red
|
||||
0xFF009640, // SPAR green
|
||||
0xFFE87722, // orange
|
||||
0xFFE31C5F, // Picnic pink
|
||||
0xFF7B1FA2, // purple
|
||||
0xFF00897B, // teal
|
||||
0xFF78909C, // grey
|
||||
];
|
||||
Reference in New Issue
Block a user