First designs for ui
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import 'package:fotodocumentation/controller/customer_controller.dart';
|
||||
import 'package:fotodocumentation/controller/login_controller.dart';
|
||||
import 'package:fotodocumentation/controller/picture_controller.dart';
|
||||
import 'package:fotodocumentation/pages/ui_utils/dialog/snackbar_utils.dart';
|
||||
import 'package:fotodocumentation/pages/ui_utils/general_style.dart';
|
||||
import 'package:fotodocumentation/pages/ui_utils/header_utils.dart';
|
||||
@@ -26,6 +28,8 @@ class DiContainer {
|
||||
DiContainer.instance.put(UrlUtils, UrlUtilsImpl());
|
||||
DiContainer.instance.put(SnackbarUtils, SnackbarUtilsImpl());
|
||||
DiContainer.instance.put(LoginController, LoginControllerImpl());
|
||||
DiContainer.instance.put(CustomerController, CustomerControllerImpl());
|
||||
DiContainer.instance.put(PictureController, PictureControllerImpl());
|
||||
}
|
||||
|
||||
void put<T>(Type key, T object) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:flutter/material.dart' show Colors, Color;
|
||||
import 'package:flutter/material.dart' show Color;
|
||||
|
||||
extension HexColor on Color {
|
||||
/// String is in the format "aabbcc" or "ffaabbcc" with an optional leading "#".
|
||||
@@ -9,21 +9,3 @@ extension HexColor on Color {
|
||||
return Color(int.parse(buffer.toString(), radix: 16));
|
||||
}
|
||||
}
|
||||
|
||||
extension RiskColor on Color {
|
||||
static const Color noRisk = Colors.transparent;
|
||||
static final Color lowRisk = HexColor.fromHex("#FFFF00");
|
||||
static final Color mediumRisk = HexColor.fromHex("#FF9000");
|
||||
static final Color highRisk = HexColor.fromHex("#FF4000");
|
||||
|
||||
static Color colorForRisk(int value) {
|
||||
if (value == 1) {
|
||||
return lowRisk;
|
||||
} else if (value == 2) {
|
||||
return mediumRisk;
|
||||
} else if (value == 3) {
|
||||
return highRisk;
|
||||
}
|
||||
return noRisk;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// needed for web horizontal scroll behavior
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fotodocumentation/main.dart';
|
||||
import 'package:fotodocumentation/pages/customer/customer_list_widget.dart';
|
||||
import 'package:fotodocumentation/pages/customer/customer_widget.dart';
|
||||
import 'package:fotodocumentation/pages/customer/picture_widget.dart';
|
||||
import 'package:fotodocumentation/pages/login/login_widget.dart';
|
||||
import 'package:fotodocumentation/utils/di_container.dart';
|
||||
import 'package:fotodocumentation/utils/login_credentials.dart';
|
||||
@@ -14,6 +16,8 @@ class GlobalRouter {
|
||||
static final GlobalKey<NavigatorState> skillEditorNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'skillEditor');
|
||||
|
||||
static final String pathHome = "/home";
|
||||
static final String pathCustomer = "/customer";
|
||||
static final String pathPicture = "/picture";
|
||||
static final String pathLogin = "/login";
|
||||
|
||||
static final GoRouter router = createRouter(pathHome);
|
||||
@@ -33,7 +37,23 @@ class GlobalRouter {
|
||||
),
|
||||
GoRoute(
|
||||
path: pathHome,
|
||||
builder: (context, state) => CustomerWidget(),
|
||||
builder: (context, state) => CustomerListWidget(),
|
||||
),
|
||||
GoRoute(
|
||||
path: "$pathCustomer/:id",
|
||||
builder: (context, state) {
|
||||
var idStr = state.pathParameters['id'];
|
||||
var id = idStr == null ? null : int.tryParse(idStr);
|
||||
return CustomerWidget(customerId: id ?? -1);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: "$pathPicture/:id",
|
||||
builder: (context, state) {
|
||||
var idStr = state.pathParameters['id'];
|
||||
var id = idStr == null ? null : int.tryParse(idStr);
|
||||
return PictureWidget(id: id ?? -1);
|
||||
},
|
||||
),
|
||||
],
|
||||
redirect: (context, state) {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
class GlobalStack<T> {
|
||||
final _list = <T>[];
|
||||
|
||||
void push(T value) => _list.add(value);
|
||||
|
||||
T pop() => _list.removeLast();
|
||||
|
||||
T peek() => _list.last;
|
||||
|
||||
bool get isEmpty => _list.isEmpty;
|
||||
|
||||
bool get isNotEmpty => _list.isNotEmpty;
|
||||
|
||||
@override
|
||||
String toString() => _list.toString();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import 'package:basic_utils/basic_utils.dart' show StringUtils;
|
||||
|
||||
abstract interface class PasswordUtils {
|
||||
String create();
|
||||
}
|
||||
|
||||
class PasswordUtilsImpl implements PasswordUtils {
|
||||
@override
|
||||
String create() {
|
||||
return StringUtils.generateRandomString(8, special: false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user