first commit
This commit is contained in:
55
.gitignore
vendored
Normal file
55
.gitignore
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
.env
|
||||
/android
|
||||
/ios
|
||||
/macos
|
||||
/web
|
||||
/linux
|
||||
/windows
|
||||
|
||||
|
||||
|
45
.metadata
Normal file
45
.metadata
Normal file
@ -0,0 +1,45 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f"
|
||||
channel: "beta"
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
base_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
- platform: android
|
||||
create_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
base_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
- platform: ios
|
||||
create_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
base_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
- platform: linux
|
||||
create_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
base_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
- platform: macos
|
||||
create_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
base_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
- platform: web
|
||||
create_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
base_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
- platform: windows
|
||||
create_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
base_revision: 8fcb74dbc16b9edb3d3f14c11c627d9e8f24fb1f
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# cek_suara_caleg
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
29
analysis_options.yaml
Normal file
29
analysis_options.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
# included above or to enable additional rules. A list of all available lints
|
||||
# and their documentation is published at
|
||||
# https://dart-lang.github.io/linter/lints/index.html.
|
||||
#
|
||||
# Instead of disabling a lint rule for the entire project in the
|
||||
# section below, it can also be suppressed for a single line of code
|
||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
BIN
assets/logo.png
Normal file
BIN
assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 87 KiB |
30
lib/app/app.bottomsheets.dart
Normal file
30
lib/app/app.bottomsheets.dart
Normal file
@ -0,0 +1,30 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// StackedBottomsheetGenerator
|
||||
// **************************************************************************
|
||||
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import 'app.locator.dart';
|
||||
import '../ui/views/detail_suara_bottom_sheet/detail_suara_bottom_sheet_view.dart';
|
||||
import '../ui/views/detail_suara_pemilih_bottom_sheet/detail_suara_pemilih_bottom_sheet_view.dart';
|
||||
|
||||
enum BottomSheetType {
|
||||
detailSuaraBottomSheetView,
|
||||
detailSuaraPemilihBottomSheetView,
|
||||
}
|
||||
|
||||
void setupBottomSheetUi() {
|
||||
final bottomsheetService = locator<BottomSheetService>();
|
||||
|
||||
final Map<BottomSheetType, SheetBuilder> builders = {
|
||||
BottomSheetType.detailSuaraBottomSheetView: (context, request, completer) =>
|
||||
DetailSuaraBottomSheetView(request: request, completer: completer),
|
||||
BottomSheetType.detailSuaraPemilihBottomSheetView:
|
||||
(context, request, completer) => DetailSuaraPemilihBottomSheetView(
|
||||
request: request, completer: completer),
|
||||
};
|
||||
|
||||
bottomsheetService.setCustomSheetBuilders(builders);
|
||||
}
|
59
lib/app/app.dart
Normal file
59
lib/app/app.dart
Normal file
@ -0,0 +1,59 @@
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
import 'package:stacked/stacked_annotations.dart';
|
||||
|
||||
import '../services/global_var.dart';
|
||||
import '../services/http_services.dart';
|
||||
import '../services/my_easyloading.dart';
|
||||
import '../services/other_function.dart';
|
||||
|
||||
import '../services/shared_prefs.dart';
|
||||
import '../ui/views/caleg_index_tracking/area_tps/area_tps_view.dart';
|
||||
import '../ui/views/caleg_index_tracking/caleg_index_tracking_view.dart';
|
||||
import '../ui/views/caleg_index_tracking/log_suara/log_suara_view.dart';
|
||||
import '../ui/views/caleg_index_tracking/pengaturan_caleg/ganti_password_dialog/ganti_password_dialog_view.dart';
|
||||
import '../ui/views/caleg_index_tracking/pengaturan_caleg/pengaturan_caleg2/pengaturan_caleg2_view.dart';
|
||||
import '../ui/views/caleg_index_tracking/pengaturan_caleg/pengaturan_caleg_view.dart';
|
||||
import '../ui/views/caleg_index_tracking/tim_survei/tim_survei_view.dart';
|
||||
import '../ui/views/detail_suara_bottom_sheet/detail_suara_bottom_sheet_view.dart';
|
||||
import '../ui/views/detail_suara_pemilih_bottom_sheet/detail_suara_pemilih_bottom_sheet_view.dart';
|
||||
import '../ui/views/login_screen/login_screen_view.dart';
|
||||
import '../ui/views/splash_screen/splash_screen_view.dart';
|
||||
|
||||
@StackedApp(
|
||||
routes: [
|
||||
MaterialRoute(page: SplashScreenView, initial: true),
|
||||
MaterialRoute(page: LoginScreenView),
|
||||
MaterialRoute(
|
||||
page: CalegIndexTrackingView,
|
||||
children: [
|
||||
MaterialRoute(page: PengaturanCalegView, initial: true),
|
||||
MaterialRoute(page: PengaturanCaleg2View),
|
||||
MaterialRoute(page: LogSuaraView),
|
||||
MaterialRoute(page: TimSurveiView),
|
||||
MaterialRoute(page: AreaTpsView)
|
||||
],
|
||||
),
|
||||
],
|
||||
dialogs: [
|
||||
StackedDialog(classType: GantiPasswordDialogView),
|
||||
// StackedDialog(classType: TambahDetailTimSurveiView)
|
||||
],
|
||||
dependencies: [
|
||||
LazySingleton(classType: NavigationService),
|
||||
LazySingleton(classType: DialogService),
|
||||
LazySingleton(classType: SnackbarService),
|
||||
LazySingleton(classType: BottomSheetService),
|
||||
// this below is mine
|
||||
LazySingleton(classType: MyEasyLoading),
|
||||
LazySingleton(classType: MyHttpServices),
|
||||
LazySingleton(classType: GlobalVar),
|
||||
LazySingleton(classType: MyFunction),
|
||||
LazySingleton(classType: MySharedPrefs)
|
||||
],
|
||||
logger: StackedLogger(),
|
||||
bottomsheets: [
|
||||
StackedBottomsheet(classType: DetailSuaraBottomSheetView),
|
||||
StackedBottomsheet(classType: DetailSuaraPemilihBottomSheetView)
|
||||
],
|
||||
)
|
||||
class App {}
|
25
lib/app/app.dialogs.dart
Normal file
25
lib/app/app.dialogs.dart
Normal file
@ -0,0 +1,25 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// StackedDialogGenerator
|
||||
// **************************************************************************
|
||||
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import 'app.locator.dart';
|
||||
import '../ui/views/caleg_index_tracking/pengaturan_caleg/ganti_password_dialog/ganti_password_dialog_view.dart';
|
||||
|
||||
enum DialogType {
|
||||
gantiPasswordDialogView,
|
||||
}
|
||||
|
||||
void setupDialogUi() {
|
||||
final dialogService = locator<DialogService>();
|
||||
|
||||
final Map<DialogType, DialogBuilder> builders = {
|
||||
DialogType.gantiPasswordDialogView: (context, request, completer) =>
|
||||
GantiPasswordDialogView(request: request, completer: completer),
|
||||
};
|
||||
|
||||
dialogService.registerCustomDialogBuilders(builders);
|
||||
}
|
41
lib/app/app.locator.dart
Normal file
41
lib/app/app.locator.dart
Normal file
@ -0,0 +1,41 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// StackedLocatorGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: public_member_api_docs, implementation_imports, depend_on_referenced_packages
|
||||
|
||||
import 'package:stacked_services/src/bottom_sheet/bottom_sheet_service.dart';
|
||||
import 'package:stacked_services/src/dialog/dialog_service.dart';
|
||||
import 'package:stacked_services/src/navigation/navigation_service.dart';
|
||||
import 'package:stacked_services/src/snackbar/snackbar_service.dart';
|
||||
import 'package:stacked_shared/stacked_shared.dart';
|
||||
|
||||
import '../services/global_var.dart';
|
||||
import '../services/http_services.dart';
|
||||
import '../services/my_easyloading.dart';
|
||||
import '../services/other_function.dart';
|
||||
import '../services/shared_prefs.dart';
|
||||
|
||||
final locator = StackedLocator.instance;
|
||||
|
||||
Future<void> setupLocator({
|
||||
String? environment,
|
||||
EnvironmentFilter? environmentFilter,
|
||||
}) async {
|
||||
// Register environments
|
||||
locator.registerEnvironment(
|
||||
environment: environment, environmentFilter: environmentFilter);
|
||||
|
||||
// Register dependencies
|
||||
locator.registerLazySingleton(() => NavigationService());
|
||||
locator.registerLazySingleton(() => DialogService());
|
||||
locator.registerLazySingleton(() => SnackbarService());
|
||||
locator.registerLazySingleton(() => BottomSheetService());
|
||||
locator.registerLazySingleton(() => MyEasyLoading());
|
||||
locator.registerLazySingleton(() => MyHttpServices());
|
||||
locator.registerLazySingleton(() => GlobalVar());
|
||||
locator.registerLazySingleton(() => MyFunction());
|
||||
locator.registerLazySingleton(() => MySharedPrefs());
|
||||
}
|
159
lib/app/app.logger.dart
Normal file
159
lib/app/app.logger.dart
Normal file
@ -0,0 +1,159 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// StackedLoggerGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: avoid_print, depend_on_referenced_packages
|
||||
|
||||
/// Maybe this should be generated for the user as well?
|
||||
///
|
||||
/// import 'package:customer_app/services/stackdriver/stackdriver_service.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
class SimpleLogPrinter extends LogPrinter {
|
||||
final String className;
|
||||
final bool printCallingFunctionName;
|
||||
final bool printCallStack;
|
||||
final List<String> exludeLogsFromClasses;
|
||||
final String? showOnlyClass;
|
||||
|
||||
SimpleLogPrinter(
|
||||
this.className, {
|
||||
this.printCallingFunctionName = true,
|
||||
this.printCallStack = false,
|
||||
this.exludeLogsFromClasses = const [],
|
||||
this.showOnlyClass,
|
||||
});
|
||||
|
||||
@override
|
||||
List<String> log(LogEvent event) {
|
||||
var color = PrettyPrinter.levelColors[event.level];
|
||||
var emoji = PrettyPrinter.levelEmojis[event.level];
|
||||
var methodName = _getMethodName();
|
||||
|
||||
var methodNameSection =
|
||||
printCallingFunctionName && methodName != null ? ' | $methodName' : '';
|
||||
var stackLog = event.stackTrace.toString();
|
||||
var output =
|
||||
'$emoji $className$methodNameSection - ${event.message}${event.error != null ? '\nERROR: ${event.error}\n' : ''}${printCallStack ? '\nSTACKTRACE:\n$stackLog' : ''}';
|
||||
|
||||
if (exludeLogsFromClasses
|
||||
.any((excludeClass) => className == excludeClass) ||
|
||||
(showOnlyClass != null && className != showOnlyClass)) return [];
|
||||
|
||||
final pattern = RegExp('.{1,800}'); // 800 is the size of each chunk
|
||||
List<String> result = [];
|
||||
|
||||
for (var line in output.split('\n')) {
|
||||
result.addAll(pattern.allMatches(line).map((match) {
|
||||
if (kReleaseMode) {
|
||||
return match.group(0)!;
|
||||
} else {
|
||||
return color!(match.group(0)!);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
String? _getMethodName() {
|
||||
try {
|
||||
final currentStack = StackTrace.current;
|
||||
final formattedStacktrace = _formatStackTrace(currentStack, 3);
|
||||
if (kIsWeb) {
|
||||
final classNameParts = _splitClassNameWords(className);
|
||||
return _findMostMatchedTrace(formattedStacktrace!, classNameParts)
|
||||
.split(' ')
|
||||
.last;
|
||||
} else {
|
||||
final realFirstLine = formattedStacktrace
|
||||
?.firstWhere((line) => line.contains(className), orElse: () => "");
|
||||
|
||||
final methodName = realFirstLine?.replaceAll('$className.', '');
|
||||
return methodName;
|
||||
}
|
||||
} catch (e) {
|
||||
// There's no deliberate function call from our code so we return null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
List<String> _splitClassNameWords(String className) {
|
||||
return className
|
||||
.split(RegExp(r'(?=[A-Z])'))
|
||||
.map((e) => e.toLowerCase())
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// When the faulty word exists in the begging this method will not be very usefull
|
||||
String _findMostMatchedTrace(
|
||||
List<String> stackTraces, List<String> keyWords) {
|
||||
String match = stackTraces.firstWhere(
|
||||
(trace) => _doesTraceContainsAllKeywords(trace, keyWords),
|
||||
orElse: () => '');
|
||||
if (match.isEmpty) {
|
||||
match = _findMostMatchedTrace(
|
||||
stackTraces, keyWords.sublist(0, keyWords.length - 1));
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
bool _doesTraceContainsAllKeywords(String stackTrace, List<String> keywords) {
|
||||
final formattedKeywordsAsRegex = RegExp(keywords.join('.*'));
|
||||
return stackTrace.contains(formattedKeywordsAsRegex);
|
||||
}
|
||||
}
|
||||
|
||||
final stackTraceRegex = RegExp(r'#[0-9]+[\s]+(.+) \(([^\s]+)\)');
|
||||
|
||||
List<String>? _formatStackTrace(StackTrace stackTrace, int methodCount) {
|
||||
var lines = stackTrace.toString().split('\n');
|
||||
|
||||
var formatted = <String>[];
|
||||
var count = 0;
|
||||
for (var line in lines) {
|
||||
var match = stackTraceRegex.matchAsPrefix(line);
|
||||
if (match != null) {
|
||||
if (match.group(2)!.startsWith('package:logger')) {
|
||||
continue;
|
||||
}
|
||||
var newLine = ("${match.group(1)}");
|
||||
formatted.add(newLine.replaceAll('<anonymous closure>', '()'));
|
||||
if (++count == methodCount) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
formatted.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
if (formatted.isEmpty) {
|
||||
return null;
|
||||
} else {
|
||||
return formatted;
|
||||
}
|
||||
}
|
||||
|
||||
Logger getLogger(
|
||||
String className, {
|
||||
bool printCallingFunctionName = true,
|
||||
bool printCallstack = false,
|
||||
List<String> exludeLogsFromClasses = const [],
|
||||
String? showOnlyClass,
|
||||
}) {
|
||||
return Logger(
|
||||
printer: SimpleLogPrinter(
|
||||
className,
|
||||
printCallingFunctionName: printCallingFunctionName,
|
||||
printCallStack: printCallstack,
|
||||
showOnlyClass: showOnlyClass,
|
||||
exludeLogsFromClasses: exludeLogsFromClasses,
|
||||
),
|
||||
output: MultiOutput([
|
||||
if (!kReleaseMode) ConsoleOutput(),
|
||||
]),
|
||||
);
|
||||
}
|
402
lib/app/app.router.dart
Normal file
402
lib/app/app.router.dart
Normal file
@ -0,0 +1,402 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// StackedNavigatorGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:cek_suara_caleg/ui/views/caleg_index_tracking/area_tps/area_tps_view.dart'
|
||||
as _i10;
|
||||
import 'package:cek_suara_caleg/ui/views/caleg_index_tracking/caleg_index_tracking_view.dart'
|
||||
as _i4;
|
||||
import 'package:cek_suara_caleg/ui/views/caleg_index_tracking/log_suara/log_suara_view.dart'
|
||||
as _i8;
|
||||
import 'package:cek_suara_caleg/ui/views/caleg_index_tracking/pengaturan_caleg/pengaturan_caleg2/pengaturan_caleg2_view.dart'
|
||||
as _i7;
|
||||
import 'package:cek_suara_caleg/ui/views/caleg_index_tracking/pengaturan_caleg/pengaturan_caleg_view.dart'
|
||||
as _i6;
|
||||
import 'package:cek_suara_caleg/ui/views/caleg_index_tracking/tim_survei/tim_survei_view.dart'
|
||||
as _i9;
|
||||
import 'package:cek_suara_caleg/ui/views/login_screen/login_screen_view.dart'
|
||||
as _i3;
|
||||
import 'package:cek_suara_caleg/ui/views/splash_screen/splash_screen_view.dart'
|
||||
as _i2;
|
||||
import 'package:flutter/material.dart' as _i5;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart' as _i1;
|
||||
import 'package:stacked_services/stacked_services.dart' as _i11;
|
||||
|
||||
class Routes {
|
||||
static const splashScreenView = '/';
|
||||
|
||||
static const loginScreenView = '/login-screen-view';
|
||||
|
||||
static const calegIndexTrackingView = '/caleg-index-tracking-view';
|
||||
|
||||
static const all = <String>{
|
||||
splashScreenView,
|
||||
loginScreenView,
|
||||
calegIndexTrackingView,
|
||||
};
|
||||
}
|
||||
|
||||
class StackedRouter extends _i1.RouterBase {
|
||||
final _routes = <_i1.RouteDef>[
|
||||
_i1.RouteDef(
|
||||
Routes.splashScreenView,
|
||||
page: _i2.SplashScreenView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
Routes.loginScreenView,
|
||||
page: _i3.LoginScreenView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
Routes.calegIndexTrackingView,
|
||||
page: _i4.CalegIndexTrackingView,
|
||||
),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i2.SplashScreenView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i2.SplashScreenView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i3.LoginScreenView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i3.LoginScreenView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i4.CalegIndexTrackingView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i4.CalegIndexTrackingView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
List<_i1.RouteDef> get routes => _routes;
|
||||
|
||||
@override
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
class CalegIndexTrackingViewRoutes {
|
||||
static const pengaturanCalegView = '';
|
||||
|
||||
static const pengaturanCaleg2View = 'pengaturan-caleg2-view';
|
||||
|
||||
static const logSuaraView = 'log-suara-view';
|
||||
|
||||
static const timSurveiView = 'tim-survei-view';
|
||||
|
||||
static const areaTpsView = 'area-tps-view';
|
||||
|
||||
static const all = <String>{
|
||||
pengaturanCalegView,
|
||||
pengaturanCaleg2View,
|
||||
logSuaraView,
|
||||
timSurveiView,
|
||||
areaTpsView,
|
||||
};
|
||||
}
|
||||
|
||||
class CalegIndexTrackingViewRouter extends _i1.RouterBase {
|
||||
final _routes = <_i1.RouteDef>[
|
||||
_i1.RouteDef(
|
||||
CalegIndexTrackingViewRoutes.pengaturanCalegView,
|
||||
page: _i6.PengaturanCalegView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
CalegIndexTrackingViewRoutes.pengaturanCaleg2View,
|
||||
page: _i7.PengaturanCaleg2View,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
CalegIndexTrackingViewRoutes.logSuaraView,
|
||||
page: _i8.LogSuaraView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
CalegIndexTrackingViewRoutes.timSurveiView,
|
||||
page: _i9.TimSurveiView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
CalegIndexTrackingViewRoutes.areaTpsView,
|
||||
page: _i10.AreaTpsView,
|
||||
),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i6.PengaturanCalegView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i6.PengaturanCalegView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i7.PengaturanCaleg2View: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i7.PengaturanCaleg2View(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i8.LogSuaraView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i8.LogSuaraView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i9.TimSurveiView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i9.TimSurveiView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i10.AreaTpsView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i10.AreaTpsView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
List<_i1.RouteDef> get routes => _routes;
|
||||
|
||||
@override
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
extension NavigatorStateExtension on _i11.NavigationService {
|
||||
Future<dynamic> navigateToSplashScreenView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(Routes.splashScreenView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToLoginScreenView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(Routes.loginScreenView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToCalegIndexTrackingView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(Routes.calegIndexTrackingView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedPengaturanCalegViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(CalegIndexTrackingViewRoutes.pengaturanCalegView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedPengaturanCaleg2ViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(
|
||||
CalegIndexTrackingViewRoutes.pengaturanCaleg2View,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToNestedLogSuaraViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(CalegIndexTrackingViewRoutes.logSuaraView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToNestedTimSurveiViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(CalegIndexTrackingViewRoutes.timSurveiView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToNestedAreaTpsViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(CalegIndexTrackingViewRoutes.areaTpsView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithSplashScreenView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(Routes.splashScreenView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithLoginScreenView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(Routes.loginScreenView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithCalegIndexTrackingView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(Routes.calegIndexTrackingView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedPengaturanCalegViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(
|
||||
CalegIndexTrackingViewRoutes.pengaturanCalegView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedPengaturanCaleg2ViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(
|
||||
CalegIndexTrackingViewRoutes.pengaturanCaleg2View,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithNestedLogSuaraViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(CalegIndexTrackingViewRoutes.logSuaraView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithNestedTimSurveiViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(CalegIndexTrackingViewRoutes.timSurveiView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithNestedAreaTpsViewInCalegIndexTrackingViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(CalegIndexTrackingViewRoutes.areaTpsView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
}
|
62
lib/app/core/custom_base_view_model.dart
Executable file
62
lib/app/core/custom_base_view_model.dart
Executable file
@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import '../../services/global_var.dart';
|
||||
import '../../services/http_services.dart';
|
||||
import '../../services/my_easyloading.dart';
|
||||
import '../../services/other_function.dart';
|
||||
import '../../services/shared_prefs.dart';
|
||||
import '../app.locator.dart';
|
||||
import '../themes/app_colors.dart';
|
||||
|
||||
class CustomBaseViewModel extends BaseViewModel {
|
||||
final dialogService = locator<DialogService>();
|
||||
final navigationService = locator<NavigationService>();
|
||||
final bottomSheetService = locator<BottomSheetService>();
|
||||
final snackbarService = locator<SnackbarService>();
|
||||
// below is mine
|
||||
final easyLoading = locator<MyEasyLoading>();
|
||||
final httpService = locator<MyHttpServices>();
|
||||
final globalVar = locator<GlobalVar>();
|
||||
final myFunction = locator<MyFunction>();
|
||||
final mySharedPrefs = locator<MySharedPrefs>();
|
||||
|
||||
void back() {
|
||||
navigationService.back();
|
||||
}
|
||||
|
||||
quitApp(BuildContext context) {
|
||||
// globalVar.backPressed = 'cantBack';
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Keluar'),
|
||||
content: const Text('Apakah Anda yakin ingin keluar?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
globalVar.backPressed = 'exitApp';
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
child: const Text('Batal'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: const Text(
|
||||
'Keluar',
|
||||
style: TextStyle(color: dangerColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
).then((value) {
|
||||
if (value == true) {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
30
lib/app/themes/app_colors.dart
Executable file
30
lib/app/themes/app_colors.dart
Executable file
@ -0,0 +1,30 @@
|
||||
import 'dart:ui';
|
||||
|
||||
const Color mainColor = Color(0xFF25C0F1);
|
||||
const Color secondaryColor = Color(0xFFB72025);
|
||||
const Color dangerColor = Color(0xFFFF4B68);
|
||||
const Color warningColor = Color(0xFFFBFFA3);
|
||||
const Color lightColor = Color(0xFFF4FAFE);
|
||||
const Color lightGreyColor = Color(0xFFFCFCFC);
|
||||
const Color stockColor = Color(0xFFEEF3F6);
|
||||
|
||||
const Color backgroundColor = Color(0xFFE5E5E5);
|
||||
const Color backgroundColor3 = Color(0xFFF6F7F8);
|
||||
|
||||
const Color orangeColor = Color.fromARGB(255, 250, 145, 84);
|
||||
const Color blueColor = Color(0xFF026AA2);
|
||||
const Color greenColor = Color(0xFF2ABB52);
|
||||
const Color redColor = Color(0xFFED1717);
|
||||
const Color greyBlueColor = Color(0xFF363F72);
|
||||
|
||||
const Color fontColor = Color(0xFF101828);
|
||||
const Color fontSecondaryColor = Color(0xFF667085);
|
||||
const Color fontParagraphColor = Color(0xFFB2B2B2);
|
||||
const Color fontGrey = Color(0xFF1C1C1C);
|
||||
|
||||
const Color mainGrey = Color(0xFF8991A4);
|
||||
const Color secondaryGrey = Color(0xFFD0D5DD);
|
||||
const Color thirdGrey = Color(0xFFF2F4F7);
|
||||
const Color fourthGrey = Color(0xFF5C5C5C);
|
||||
const Color fifthGrey = Color(0xFFEBEBEB);
|
||||
const Color sixthGrey = Color(0xFF151515);
|
44
lib/app/themes/app_text.dart
Normal file
44
lib/app/themes/app_text.dart
Normal file
@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'app_colors.dart';
|
||||
|
||||
const regularTextStyle = TextStyle(
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: fontColor);
|
||||
|
||||
const italicTextStyle = TextStyle(
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 14,
|
||||
color: fontColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
);
|
||||
|
||||
const mediumTextStyle = TextStyle(
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: fontColor,
|
||||
);
|
||||
|
||||
const semiBoldTextStyle = TextStyle(
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: fontColor,
|
||||
);
|
||||
|
||||
const boldTextStyle = TextStyle(
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: fontColor,
|
||||
);
|
||||
|
||||
const extraBoldTextStyle = TextStyle(
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: fontColor,
|
||||
);
|
126
lib/app/themes/app_theme.dart
Executable file
126
lib/app/themes/app_theme.dart
Executable file
@ -0,0 +1,126 @@
|
||||
// ignore_for_file: deprecated_member_use
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'app_colors.dart';
|
||||
import 'app_text.dart';
|
||||
|
||||
ThemeData appTheme = ThemeData(
|
||||
useMaterial3: true,
|
||||
primaryColor: mainColor,
|
||||
scaffoldBackgroundColor: Colors.white,
|
||||
canvasColor: Colors.white,
|
||||
fontFamily: 'Poppins',
|
||||
appBarTheme: AppBarTheme(
|
||||
elevation: 0,
|
||||
titleTextStyle: boldTextStyle.copyWith(fontSize: 16, color: fontGrey),
|
||||
centerTitle: true,
|
||||
),
|
||||
textTheme: TextTheme(
|
||||
headline1: regularTextStyle.copyWith(fontSize: 32),
|
||||
headline2: regularTextStyle.copyWith(fontSize: 20),
|
||||
headline3: regularTextStyle.copyWith(fontSize: 18),
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: mainColor,
|
||||
foregroundColor: Colors.white,
|
||||
disabledBackgroundColor: mainColor.withOpacity(.3),
|
||||
minimumSize: const Size(double.maxFinite, 58),
|
||||
textStyle: boldTextStyle,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
shadowColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
),
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: OutlinedButton.styleFrom(
|
||||
textStyle: boldTextStyle,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
side: const BorderSide(
|
||||
color: mainColor,
|
||||
width: 1,
|
||||
),
|
||||
foregroundColor: mainColor,
|
||||
// disabledForegroundColor: mainColor.withOpacity(.3),
|
||||
minimumSize: const Size(double.maxFinite, 58),
|
||||
),
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: mainColor,
|
||||
disabledForegroundColor: mainColor.withOpacity(.3),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
textStyle: semiBoldTextStyle,
|
||||
shadowColor: Colors.transparent,
|
||||
),
|
||||
),
|
||||
iconTheme: const IconThemeData(
|
||||
color: mainColor,
|
||||
),
|
||||
listTileTheme: ListTileThemeData(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
fillColor: MaterialStateProperty.all(mainColor),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
side: const BorderSide(
|
||||
color: secondaryGrey,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
radioTheme: RadioThemeData(
|
||||
fillColor: MaterialStateProperty.all(mainColor),
|
||||
),
|
||||
tabBarTheme: TabBarTheme(
|
||||
labelColor: mainColor,
|
||||
unselectedLabelColor: secondaryGrey,
|
||||
labelStyle: boldTextStyle.copyWith(fontSize: 16),
|
||||
unselectedLabelStyle: mediumTextStyle.copyWith(fontSize: 16),
|
||||
),
|
||||
chipTheme: ChipThemeData(
|
||||
backgroundColor: Colors.white,
|
||||
disabledColor: Colors.white,
|
||||
selectedColor: Colors.white,
|
||||
secondarySelectedColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
side: const BorderSide(color: fifthGrey),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
labelStyle: regularTextStyle.copyWith(fontSize: 12, color: fontGrey),
|
||||
secondaryLabelStyle:
|
||||
regularTextStyle.copyWith(fontSize: 12, color: secondaryColor),
|
||||
deleteIconColor: fontGrey,
|
||||
showCheckmark: false,
|
||||
),
|
||||
popupMenuTheme: PopupMenuThemeData(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: const BorderSide(
|
||||
color: fifthGrey,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
colorScheme: const ColorScheme.light(
|
||||
primary: mainColor,
|
||||
secondary: secondaryColor,
|
||||
onPrimary: Colors.white,
|
||||
onSecondary: Colors.white,
|
||||
error: dangerColor,
|
||||
onError: dangerColor,
|
||||
background: backgroundColor,
|
||||
).copyWith(background: Colors.white),
|
||||
);
|
52
lib/main.dart
Normal file
52
lib/main.dart
Normal file
@ -0,0 +1,52 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import 'app/app.bottomsheets.dart';
|
||||
import 'app/app.dialogs.dart';
|
||||
import 'app/app.locator.dart';
|
||||
import 'app/app.router.dart';
|
||||
import 'app/themes/app_theme.dart';
|
||||
|
||||
Future main() async {
|
||||
HttpOverrides.global = MyHttpOverrides();
|
||||
await dotenv.load(fileName: ".env");
|
||||
await setupAllLocator();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Cek Suara Caleg',
|
||||
theme: appTheme,
|
||||
debugShowCheckedModeBanner: false,
|
||||
navigatorKey: StackedService.navigatorKey,
|
||||
onGenerateRoute: StackedRouter().onGenerateRoute,
|
||||
builder: EasyLoading.init(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setupAllLocator() async {
|
||||
await setupLocator();
|
||||
setupDialogUi();
|
||||
setupBottomSheetUi();
|
||||
// setupSnackbarUi();
|
||||
}
|
||||
|
||||
class MyHttpOverrides extends HttpOverrides {
|
||||
@override
|
||||
HttpClient createHttpClient(SecurityContext? context) {
|
||||
return super.createHttpClient(context)
|
||||
..badCertificateCallback =
|
||||
(X509Certificate cert, String host, int port) => true;
|
||||
}
|
||||
}
|
44
lib/model/area_model.dart
Normal file
44
lib/model/area_model.dart
Normal file
@ -0,0 +1,44 @@
|
||||
class AreaListModel {
|
||||
List<AreaModel>? area;
|
||||
int? jumlah;
|
||||
|
||||
AreaListModel({this.area, this.jumlah});
|
||||
|
||||
AreaListModel.fromJson(Map<String, dynamic> json) {
|
||||
if (json['area'] != null) {
|
||||
area = <AreaModel>[];
|
||||
json['area'].forEach((v) {
|
||||
area!.add(AreaModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
jumlah = json['jumlah'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (area != null) {
|
||||
data['area'] = area!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['jumlah'] = jumlah;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class AreaModel {
|
||||
int? idArea;
|
||||
String? namaArea;
|
||||
|
||||
AreaModel({this.idArea, this.namaArea});
|
||||
|
||||
AreaModel.fromJson(Map<String, dynamic> json) {
|
||||
idArea = json['id_area'];
|
||||
namaArea = json['nama_area'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id_area'] = idArea;
|
||||
data['nama_area'] = namaArea;
|
||||
return data;
|
||||
}
|
||||
}
|
50
lib/model/caleg_model.dart
Normal file
50
lib/model/caleg_model.dart
Normal file
@ -0,0 +1,50 @@
|
||||
class CalegListModel {
|
||||
List<CalegModel>? caleg;
|
||||
int? jumlah;
|
||||
|
||||
CalegListModel({this.caleg, this.jumlah});
|
||||
|
||||
CalegListModel.fromJson(Map<String, dynamic> json) {
|
||||
if (json['caleg'] != null) {
|
||||
caleg = <CalegModel>[];
|
||||
json['caleg'].forEach((v) {
|
||||
caleg!.add(CalegModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
jumlah = json['jumlah'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (caleg != null) {
|
||||
data['caleg'] = caleg!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['jumlah'] = jumlah;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class CalegModel {
|
||||
int? idCaleg;
|
||||
String? namaCaleg;
|
||||
int? nomorUrutCaleg;
|
||||
String? foto;
|
||||
|
||||
CalegModel({this.idCaleg, this.namaCaleg, this.nomorUrutCaleg, this.foto});
|
||||
|
||||
CalegModel.fromJson(Map<String, dynamic> json) {
|
||||
idCaleg = json['id_caleg'];
|
||||
namaCaleg = json['nama_caleg'];
|
||||
nomorUrutCaleg = json['nomor_urut_caleg'];
|
||||
foto = json['foto'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id_caleg'] = idCaleg;
|
||||
data['nama_caleg'] = namaCaleg;
|
||||
data['nomor_urut_caleg'] = nomorUrutCaleg;
|
||||
data['foto'] = foto;
|
||||
return data;
|
||||
}
|
||||
}
|
21
lib/model/my_response.model.dart
Normal file
21
lib/model/my_response.model.dart
Normal file
@ -0,0 +1,21 @@
|
||||
class MyResponseModel {
|
||||
String? message;
|
||||
dynamic data;
|
||||
bool? status;
|
||||
|
||||
MyResponseModel({this.message, this.data, this.status});
|
||||
|
||||
MyResponseModel.fromJson(Map<String, dynamic> json) {
|
||||
message = json['message'];
|
||||
data = json['data'];
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['message'] = message;
|
||||
data['data'] = this.data;
|
||||
data['status'] = status;
|
||||
return data;
|
||||
}
|
||||
}
|
75
lib/model/pemilih_model.dart
Normal file
75
lib/model/pemilih_model.dart
Normal file
@ -0,0 +1,75 @@
|
||||
import '../app/app.locator.dart';
|
||||
import '../services/other_function.dart';
|
||||
|
||||
class PemilihDetailModel {
|
||||
List<PemilihModel>? pemilihModel;
|
||||
int? jumlah;
|
||||
|
||||
PemilihDetailModel({this.pemilihModel, this.jumlah});
|
||||
|
||||
PemilihDetailModel.fromJson(Map<String, dynamic> json) {
|
||||
if (json['data'] != null) {
|
||||
pemilihModel = <PemilihModel>[];
|
||||
json['data'].forEach((v) {
|
||||
pemilihModel!.add(PemilihModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
jumlah = json['jumlah'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (pemilihModel != null) {
|
||||
data['data'] = pemilihModel!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['jumlah'] = jumlah;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class PemilihModel {
|
||||
final myFunction = locator<MyFunction>();
|
||||
|
||||
String? nikNomorHp;
|
||||
String? namaPemilih;
|
||||
String? img;
|
||||
String? nikTimSurvei;
|
||||
String? namaTimSurvei;
|
||||
String? namaCaleg;
|
||||
String? namaArea;
|
||||
String? createdAt;
|
||||
|
||||
PemilihModel(
|
||||
{this.nikNomorHp,
|
||||
this.namaPemilih,
|
||||
this.img,
|
||||
this.nikTimSurvei,
|
||||
this.namaTimSurvei,
|
||||
this.namaCaleg,
|
||||
this.namaArea,
|
||||
this.createdAt});
|
||||
|
||||
PemilihModel.fromJson(Map<String, dynamic> json) {
|
||||
nikNomorHp = json['nik_nomor_hp'];
|
||||
namaPemilih = json['nama_pemilih'];
|
||||
img = json['img'];
|
||||
nikTimSurvei = json['nik_tim_survei'];
|
||||
namaTimSurvei = json['nama_tim_survei'];
|
||||
namaCaleg = json['nama_caleg'];
|
||||
namaArea = json['nama_area'];
|
||||
createdAt = myFunction.convertDateTime(json['created_at']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['nik_nomor_hp'] = nikNomorHp;
|
||||
data['nama_pemilih'] = namaPemilih;
|
||||
data['img'] = img;
|
||||
data['nik_tim_survei'] = nikTimSurvei;
|
||||
data['nama_tim_survei'] = namaTimSurvei;
|
||||
data['nama_caleg'] = namaCaleg;
|
||||
data['nama_area'] = namaArea;
|
||||
data['created_at'] = createdAt;
|
||||
return data;
|
||||
}
|
||||
}
|
57
lib/model/tim_survei_model.dart
Normal file
57
lib/model/tim_survei_model.dart
Normal file
@ -0,0 +1,57 @@
|
||||
import '../app/app.locator.dart';
|
||||
import '../services/other_function.dart';
|
||||
|
||||
class TimSurveiListModel {
|
||||
List<TimSurveiModel>? survei;
|
||||
int? jumlah;
|
||||
|
||||
TimSurveiListModel({this.survei, this.jumlah});
|
||||
|
||||
TimSurveiListModel.fromJson(Map<String, dynamic> json) {
|
||||
if (json['survei'] != null) {
|
||||
survei = <TimSurveiModel>[];
|
||||
json['survei'].forEach((v) {
|
||||
survei!.add(TimSurveiModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
jumlah = json['jumlah'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (survei != null) {
|
||||
data['survei'] = survei!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['jumlah'] = jumlah;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class TimSurveiModel {
|
||||
final myFunction = locator<MyFunction>();
|
||||
String? nik;
|
||||
String? nama;
|
||||
int? idCaleg;
|
||||
String? namaCaleg;
|
||||
String? createdAt;
|
||||
|
||||
TimSurveiModel({this.nik, this.nama, this.createdAt});
|
||||
|
||||
TimSurveiModel.fromJson(Map<String, dynamic> json) {
|
||||
nik = json['nik'];
|
||||
nama = json['nama'];
|
||||
idCaleg = json['id_caleg'];
|
||||
namaCaleg = json['nama_caleg'];
|
||||
createdAt = myFunction.convertDateTime(json['created_at']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['nik'] = nik;
|
||||
data['nama'] = nama;
|
||||
data['id_caleg'] = idCaleg;
|
||||
data['nama_caleg'] = namaCaleg;
|
||||
data['created_at'] = createdAt;
|
||||
return data;
|
||||
}
|
||||
}
|
3
lib/services/global_var.dart
Normal file
3
lib/services/global_var.dart
Normal file
@ -0,0 +1,3 @@
|
||||
class GlobalVar {
|
||||
String backPressed = 'backNormal';
|
||||
}
|
73
lib/services/http_services.dart
Normal file
73
lib/services/http_services.dart
Normal file
@ -0,0 +1,73 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import '../app/app.locator.dart';
|
||||
import '../app/app.logger.dart';
|
||||
|
||||
class MyHttpServices {
|
||||
final _log = getLogger('MyHttpServices');
|
||||
final _snackbarService = locator<SnackbarService>();
|
||||
final _options = BaseOptions(
|
||||
baseUrl: dotenv.env['api_url']!,
|
||||
connectTimeout: const Duration(milliseconds: 60000),
|
||||
receiveTimeout: const Duration(milliseconds: 60000),
|
||||
);
|
||||
|
||||
late Dio _dio;
|
||||
|
||||
MyHttpServices() {
|
||||
_dio = Dio(_options);
|
||||
}
|
||||
|
||||
Future<Response> get(String path) async {
|
||||
try {
|
||||
return await _dio.get(path);
|
||||
} on DioException catch (e) {
|
||||
String response = e.response != null
|
||||
? e.response!.data['message'].toString()
|
||||
: e.toString();
|
||||
_log.e('ini errornya: $response');
|
||||
_snackbarService.showSnackbar(
|
||||
message: response,
|
||||
title: 'Error',
|
||||
duration: const Duration(milliseconds: 1000),
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<Response> postWithFormData(String path, FormData formData) async {
|
||||
try {
|
||||
return await _dio.post(path, data: formData);
|
||||
} on DioException catch (e) {
|
||||
String response = e.response != null
|
||||
? e.response!.data['message'].toString()
|
||||
: e.toString();
|
||||
_log.e('ini errornya: $response');
|
||||
_snackbarService.showSnackbar(
|
||||
message: response,
|
||||
title: 'Error',
|
||||
duration: const Duration(milliseconds: 1000),
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<Response> delete(String path) async {
|
||||
try {
|
||||
return await _dio.delete(path);
|
||||
} on DioException catch (e) {
|
||||
String response = e.response != null
|
||||
? e.response!.data['message'].toString()
|
||||
: e.toString();
|
||||
_log.e('ini errornya: $response');
|
||||
_snackbarService.showSnackbar(
|
||||
message: response,
|
||||
title: 'Error',
|
||||
duration: const Duration(milliseconds: 1000),
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
39
lib/services/my_easyloading.dart
Normal file
39
lib/services/my_easyloading.dart
Normal file
@ -0,0 +1,39 @@
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
|
||||
class MyEasyLoading {
|
||||
showLoading() {
|
||||
EasyLoading.show(
|
||||
status: 'loading...',
|
||||
maskType: EasyLoadingMaskType.black,
|
||||
dismissOnTap: false,
|
||||
);
|
||||
}
|
||||
|
||||
dismissLoading() {
|
||||
EasyLoading.dismiss();
|
||||
}
|
||||
|
||||
customLoading(String message) {
|
||||
EasyLoading.show(
|
||||
status: message,
|
||||
maskType: EasyLoadingMaskType.black,
|
||||
dismissOnTap: false,
|
||||
);
|
||||
}
|
||||
|
||||
showSuccess(String message) {
|
||||
EasyLoading.showSuccess(message);
|
||||
}
|
||||
|
||||
showError(String message) {
|
||||
EasyLoading.showError(message);
|
||||
}
|
||||
|
||||
showInfo(String message) {
|
||||
EasyLoading.showInfo(message);
|
||||
}
|
||||
|
||||
showProgress(double progress, String status) {
|
||||
EasyLoading.showProgress(progress, status: status);
|
||||
}
|
||||
}
|
16
lib/services/other_function.dart
Normal file
16
lib/services/other_function.dart
Normal file
@ -0,0 +1,16 @@
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class MyFunction {
|
||||
String convertDateTime(String input) {
|
||||
DateTime dateTime = DateTime.parse(input);
|
||||
String formattedDateTime =
|
||||
DateFormat('dd-MM-yyyy | hh.mm.ss a').format(dateTime);
|
||||
return formattedDateTime;
|
||||
}
|
||||
|
||||
// chnage | to \n in string
|
||||
String convertDateTime2(String input) {
|
||||
input = input.replaceAll('| ', '\n');
|
||||
return input;
|
||||
}
|
||||
}
|
25
lib/services/shared_prefs.dart
Normal file
25
lib/services/shared_prefs.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class MySharedPrefs {
|
||||
final Future<SharedPreferences> prefs = SharedPreferences.getInstance();
|
||||
|
||||
Future<String?> getString(String key) async {
|
||||
final SharedPreferences prefs = await this.prefs;
|
||||
return prefs.getString(key);
|
||||
}
|
||||
|
||||
Future<bool> setString(String key, String value) async {
|
||||
final SharedPreferences prefs = await this.prefs;
|
||||
return prefs.setString(key, value);
|
||||
}
|
||||
|
||||
Future<bool> removeString(String key) async {
|
||||
final SharedPreferences prefs = await this.prefs;
|
||||
return prefs.remove(key);
|
||||
}
|
||||
|
||||
Future<bool> clear() async {
|
||||
final SharedPreferences prefs = await this.prefs;
|
||||
return prefs.clear();
|
||||
}
|
||||
}
|
144
lib/ui/views/caleg_index_tracking/area_tps/area_tps_view.dart
Normal file
144
lib/ui/views/caleg_index_tracking/area_tps/area_tps_view.dart
Normal file
@ -0,0 +1,144 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../../../../app/themes/app_colors.dart';
|
||||
import '../../../../app/themes/app_text.dart';
|
||||
import './area_tps_view_model.dart';
|
||||
|
||||
class AreaTpsView extends StatelessWidget {
|
||||
const AreaTpsView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<AreaTpsViewModel>.reactive(
|
||||
viewModelBuilder: () => AreaTpsViewModel(),
|
||||
onViewModelReady: (AreaTpsViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
AreaTpsViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
// model.log.i('backPressed: ${model.globalVar.backPressed}');
|
||||
if (model.globalVar.backPressed == 'exitApp') {
|
||||
// model.back();
|
||||
model.quitApp(context);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: warningColor,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Jumlah Area TPS : ",
|
||||
style: italicTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${model.jumlahArea} TPS',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.location_on_outlined,
|
||||
color: fontColor,
|
||||
),
|
||||
// SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: warningColor,
|
||||
),
|
||||
child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (model.isBusy)
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
if (!model.isBusy)
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
if (model.jumlahArea == 0)
|
||||
Center(
|
||||
child: model.status == true
|
||||
? const Text(
|
||||
'Belum ada area diinput')
|
||||
: const Text(
|
||||
'Gagal mengambil data'),
|
||||
),
|
||||
if (model.jumlahArea > 0)
|
||||
for (var i = 0;
|
||||
i < model.jumlahArea;
|
||||
i++)
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: Text('${i + 1}'),
|
||||
title: Text(
|
||||
'${model.listAreaModel[i].namaArea}'),
|
||||
trailing: IconButton(
|
||||
// trash bin icon
|
||||
icon: const Icon(
|
||||
Icons.list_alt_outlined,
|
||||
color: mainColor,
|
||||
),
|
||||
onPressed: () {
|
||||
model.cekSuara(
|
||||
model.listAreaModel[i]);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
import '../../../../app/app.bottomsheets.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../model/area_model.dart';
|
||||
import '../../../../model/my_response.model.dart';
|
||||
|
||||
class AreaTpsViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('AreaTpsViewModel');
|
||||
|
||||
List<AreaModel> listAreaModel = [];
|
||||
int jumlahArea = 0;
|
||||
bool status = false;
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = 'exitApp';
|
||||
String? idCaleg = await mySharedPrefs.getString('id');
|
||||
await getData(idCaleg!);
|
||||
}
|
||||
|
||||
getData(String idCaleg) async {
|
||||
setBusy(true);
|
||||
|
||||
try {
|
||||
var response = await httpService.get('/area/cek_area_caleg/$idCaleg');
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
AreaListModel areaListModel =
|
||||
AreaListModel.fromJson(myResponseModel.data);
|
||||
listAreaModel = areaListModel.area ?? [];
|
||||
log.i('listAreaModel: $listAreaModel');
|
||||
jumlahArea = listAreaModel.length;
|
||||
log.i('jumlahArea: $jumlahArea');
|
||||
status = true;
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
status = false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
cekSuara(AreaModel areaModel) async {
|
||||
await bottomSheetService.showCustomSheet(
|
||||
data: areaModel.idArea,
|
||||
barrierDismissible: true,
|
||||
isScrollControlled: true,
|
||||
title: 'Detail Suara Area ${areaModel.namaArea}',
|
||||
description: 'Tim Survei',
|
||||
ignoreSafeArea: false,
|
||||
variant: BottomSheetType.detailSuaraBottomSheetView,
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
import 'package:stylish_bottom_bar/model/bar_items.dart';
|
||||
import 'package:stylish_bottom_bar/stylish_bottom_bar.dart';
|
||||
|
||||
import '../../../app/app.router.dart';
|
||||
import '../../../app/themes/app_colors.dart';
|
||||
import '../../../app/themes/app_text.dart';
|
||||
import './caleg_index_tracking_view_model.dart';
|
||||
|
||||
class CalegIndexTrackingView extends StatelessWidget {
|
||||
const CalegIndexTrackingView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<CalegIndexTrackingViewModel>.reactive(
|
||||
viewModelBuilder: () => CalegIndexTrackingViewModel(),
|
||||
onViewModelReady: (CalegIndexTrackingViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
CalegIndexTrackingViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
model.header,
|
||||
style: const TextStyle(
|
||||
color: fontColor,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
backgroundColor: warningColor,
|
||||
elevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
model.logout();
|
||||
},
|
||||
icon: const Icon(Icons.logout, color: fontColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
extendBody: false,
|
||||
body: ExtendedNavigator(
|
||||
router: CalegIndexTrackingViewRouter(),
|
||||
navigatorKey: StackedService.nestedNavigationKey(3),
|
||||
),
|
||||
bottomNavigationBar: StylishBottomBar(
|
||||
items: [
|
||||
for (var item in model.bottomNavBarList)
|
||||
BottomBarItem(
|
||||
icon: Icon(item['icon'],
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? warningColor
|
||||
: fontColor),
|
||||
title: Text(
|
||||
item['name'],
|
||||
style: regularTextStyle.copyWith(
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? warningColor
|
||||
: fontColor,
|
||||
),
|
||||
// textAlign: TextAlign.l,
|
||||
),
|
||||
backgroundColor: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? fontColor
|
||||
: fontColor,
|
||||
),
|
||||
],
|
||||
currentIndex: model.currentIndex,
|
||||
option: BubbleBarOptions(),
|
||||
hasNotch: true,
|
||||
backgroundColor: warningColor,
|
||||
onTap: (value) {
|
||||
model.handleNavigation(value);
|
||||
},
|
||||
// fabLocation: StylishBarFabLocation.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import '../../../app/app.locator.dart';
|
||||
import '../../../app/app.logger.dart';
|
||||
import '../../../app/app.router.dart';
|
||||
import '../../../services/global_var.dart';
|
||||
import '../../../services/shared_prefs.dart';
|
||||
|
||||
class CalegIndexTrackingViewModel extends IndexTrackingViewModel {
|
||||
final log = getLogger('CalegIndexTrackingViewModel');
|
||||
final mySharedPrefs = locator<MySharedPrefs>();
|
||||
final navigationService = locator<NavigationService>();
|
||||
final globalVar = locator<GlobalVar>();
|
||||
final snackbarService = locator<SnackbarService>();
|
||||
final dialogService = locator<DialogService>();
|
||||
|
||||
final _bottomNavBarList = [
|
||||
{
|
||||
'name': 'Area\nTPS',
|
||||
'icon': Icons.location_on_outlined,
|
||||
'header': 'Area TPS',
|
||||
},
|
||||
{
|
||||
'name': 'Hasil\nSuara',
|
||||
'icon': Icons.supervised_user_circle_outlined,
|
||||
'header': 'Hasil Suara',
|
||||
},
|
||||
{
|
||||
'name': 'Tim \nSurvei',
|
||||
'icon': Icons.history_edu_outlined,
|
||||
'header': 'History Survei',
|
||||
},
|
||||
{
|
||||
'name': 'Pengaturan',
|
||||
'icon': Icons.settings_outlined,
|
||||
'header': 'Pengaturan',
|
||||
},
|
||||
];
|
||||
|
||||
String header = 'Pengaturan';
|
||||
|
||||
List<Map<String, dynamic>> get bottomNavBarList => _bottomNavBarList;
|
||||
|
||||
final List<String> _views = [
|
||||
CalegIndexTrackingViewRoutes.areaTpsView,
|
||||
CalegIndexTrackingViewRoutes.logSuaraView,
|
||||
CalegIndexTrackingViewRoutes.timSurveiView,
|
||||
CalegIndexTrackingViewRoutes.pengaturanCaleg2View,
|
||||
];
|
||||
|
||||
Future<void> init() async {
|
||||
String? level = await mySharedPrefs.getString('level');
|
||||
log.i('level: $level');
|
||||
if (level != 'caleg') {
|
||||
mySharedPrefs.clear();
|
||||
snackbarService.showSnackbar(
|
||||
message: 'Anda tidak memiliki akses',
|
||||
title: 'Akses Ditolak',
|
||||
duration: const Duration(milliseconds: 2500),
|
||||
);
|
||||
navigationService.clearStackAndShow(Routes.loginScreenView);
|
||||
}
|
||||
setIndex(3);
|
||||
}
|
||||
|
||||
void handleNavigation(int index) {
|
||||
// log.d("handleNavigation: $index");
|
||||
// log.d("currentIndex: $currentIndex");
|
||||
|
||||
// if (currentIndex == index) return;
|
||||
|
||||
setIndex(index);
|
||||
header = _bottomNavBarList[index]['header'] as String;
|
||||
navigationService.navigateTo(
|
||||
_views[index],
|
||||
id: 3,
|
||||
);
|
||||
}
|
||||
|
||||
logout() async {
|
||||
dialogService
|
||||
.showConfirmationDialog(
|
||||
title: 'Konfirmasi',
|
||||
description: 'Apakah anda yakin ingin keluar?',
|
||||
cancelTitle: 'Batal',
|
||||
confirmationTitle: 'Keluar',
|
||||
)
|
||||
.then((value) async {
|
||||
if (value!.confirmed) {
|
||||
await mySharedPrefs.clear();
|
||||
navigationService.clearStackAndShow(Routes.loginScreenView);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
161
lib/ui/views/caleg_index_tracking/log_suara/log_suara_view.dart
Normal file
161
lib/ui/views/caleg_index_tracking/log_suara/log_suara_view.dart
Normal file
@ -0,0 +1,161 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../../../../app/themes/app_colors.dart';
|
||||
import '../../../../app/themes/app_text.dart';
|
||||
import './log_suara_view_model.dart';
|
||||
|
||||
class LogSuaraView extends StatelessWidget {
|
||||
const LogSuaraView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<LogSuaraViewModel>.reactive(
|
||||
viewModelBuilder: () => LogSuaraViewModel(),
|
||||
onViewModelReady: (LogSuaraViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
LogSuaraViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
// model.log.i('backPressed: ${model.globalVar.backPressed}');
|
||||
if (model.globalVar.backPressed == 'exitApp') {
|
||||
// model.back();
|
||||
model.quitApp(context);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: warningColor,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"Jumlah Suara : ",
|
||||
style: italicTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${model.counter} suara',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.people_alt_outlined,
|
||||
color: fontColor,
|
||||
),
|
||||
// SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: model.isBusy
|
||||
? Alignment.center
|
||||
: model.status == true
|
||||
? model.counter > 0
|
||||
? Alignment.topCenter
|
||||
: Alignment.center
|
||||
: Alignment.center,
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: warningColor,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (model.isBusy)
|
||||
const Center(
|
||||
child: CircularProgressIndicator()),
|
||||
if (!model.isBusy &&
|
||||
model.status == true &&
|
||||
model.counter > 0)
|
||||
for (var i = 0; i < model.counter; i++)
|
||||
Card(
|
||||
child: ListTile(
|
||||
// leading is datetime dummy
|
||||
leading: Text(model.myFunction
|
||||
.convertDateTime2(model
|
||||
.listPemilih[i].createdAt!)),
|
||||
title: Text(
|
||||
model.listPemilih[i].namaPemilih!,
|
||||
style: boldTextStyle,
|
||||
),
|
||||
subtitle: Text(
|
||||
model.listPemilih[i].namaArea!,
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.info_outline,
|
||||
color: mainColor,
|
||||
),
|
||||
onPressed: () {
|
||||
model.showDetailPemilih(
|
||||
model.listPemilih[i],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!model.isBusy &&
|
||||
model.status == true &&
|
||||
model.counter == 0)
|
||||
const Center(
|
||||
child: Text(
|
||||
'Belum ada data',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
),
|
||||
if (!model.isBusy && model.status == false)
|
||||
const Center(
|
||||
child: Text(
|
||||
'Error: Gagal mengambil data dari server',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
import '../../../../app/app.bottomsheets.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../model/my_response.model.dart';
|
||||
import '../../../../model/pemilih_model.dart';
|
||||
|
||||
class LogSuaraViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('LogSuaraViewModel');
|
||||
int counter = 0;
|
||||
List<PemilihModel> listPemilih = [];
|
||||
bool status = false;
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = 'exitApp';
|
||||
String? idCaleg = await mySharedPrefs.getString('id');
|
||||
await getData(idCaleg!);
|
||||
}
|
||||
|
||||
getData(String idCaleg) async {
|
||||
setBusy(true);
|
||||
|
||||
try {
|
||||
var response = await httpService.get('caleg/suara/$idCaleg');
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
PemilihDetailModel pemilihDetailModel =
|
||||
PemilihDetailModel.fromJson(myResponseModel.data);
|
||||
listPemilih = pemilihDetailModel.pemilihModel!;
|
||||
counter = listPemilih.length;
|
||||
|
||||
status = true;
|
||||
} catch (e) {
|
||||
log.e('error: $e');
|
||||
status = false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
showDetailPemilih(PemilihModel listPemilih) async {
|
||||
await bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.detailSuaraPemilihBottomSheetView,
|
||||
title: 'Detail Suara Pemilih',
|
||||
description: 'Detail Suara Pemilih',
|
||||
// isScrollControlled: true,
|
||||
data: listPemilih,
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,191 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
import 'package:validatorless/validatorless.dart';
|
||||
|
||||
import '../../../../../app/themes/app_colors.dart';
|
||||
import '../../../../../app/themes/app_text.dart';
|
||||
import '../../../../widgets/my_textformfield.dart';
|
||||
import './ganti_password_dialog_view_model.dart';
|
||||
|
||||
class GantiPasswordDialogView extends StatelessWidget {
|
||||
final DialogRequest? request;
|
||||
final Function(DialogResponse)? completer;
|
||||
|
||||
const GantiPasswordDialogView({
|
||||
Key? key,
|
||||
this.request,
|
||||
this.completer,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<GantiPasswordDialogViewModel>.reactive(
|
||||
viewModelBuilder: () => GantiPasswordDialogViewModel(),
|
||||
onViewModelReady: (GantiPasswordDialogViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
GantiPasswordDialogViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Dialog(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Form(
|
||||
key: model.globalKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'Ganti Password',
|
||||
style: boldTextStyle.copyWith(fontSize: 18),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
MyTextFormField(
|
||||
labelText: 'Password Lama',
|
||||
hintText: 'Masukkan password lama',
|
||||
obscureText: model.isPasswordLamaObscure,
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
model.isPasswordLamaObscure =
|
||||
!model.isPasswordLamaObscure;
|
||||
model.notifyListeners();
|
||||
},
|
||||
icon: Icon(
|
||||
model.isPasswordLamaObscure
|
||||
? Icons.visibility_off
|
||||
: Icons.visibility,
|
||||
),
|
||||
),
|
||||
controller: model.passwordLamaController,
|
||||
validator: Validatorless.multiple(
|
||||
[
|
||||
Validatorless.required(
|
||||
'Password lama tidak boleh kosong'),
|
||||
Validatorless.min(
|
||||
8, 'Password lama minimal 8 karakter'),
|
||||
Validatorless.compare(
|
||||
// compare with thePasswordLamaController
|
||||
model.thePasswordLamaController,
|
||||
'Password lama tidak sama',
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MyTextFormField(
|
||||
labelText: 'Password Baru',
|
||||
hintText: 'Masukkan password baru',
|
||||
obscureText: model.isPasswordBaruObscure,
|
||||
controller: model.passwordBaruController,
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
model.isPasswordBaruObscure =
|
||||
!model.isPasswordBaruObscure;
|
||||
model.notifyListeners();
|
||||
},
|
||||
icon: Icon(
|
||||
model.isPasswordBaruObscure
|
||||
? Icons.visibility_off
|
||||
: Icons.visibility,
|
||||
),
|
||||
),
|
||||
validator: Validatorless.multiple(
|
||||
[
|
||||
Validatorless.required(
|
||||
'Password baru tidak boleh kosong'),
|
||||
Validatorless.min(
|
||||
8, 'Password baru minimal 8 karakter'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MyTextFormField(
|
||||
labelText: 'Konfirmasi Password Baru',
|
||||
hintText: 'Masukkan konfirmasi password baru',
|
||||
obscureText: model.isKonfirmasiPasswordBaruObscure,
|
||||
controller: model.konfirmasiPasswordBaruController,
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
model.isKonfirmasiPasswordBaruObscure =
|
||||
!model.isKonfirmasiPasswordBaruObscure;
|
||||
model.notifyListeners();
|
||||
},
|
||||
icon: Icon(
|
||||
model.isKonfirmasiPasswordBaruObscure
|
||||
? Icons.visibility_off
|
||||
: Icons.visibility,
|
||||
),
|
||||
),
|
||||
validator: Validatorless.multiple(
|
||||
[
|
||||
Validatorless.required(
|
||||
'Konfirmasi password baru tidak boleh kosong'),
|
||||
Validatorless.min(
|
||||
8, 'Konfirmasi password baru minimal 8 karakter'),
|
||||
Validatorless.compare(
|
||||
model.passwordBaruController,
|
||||
'Password baru tidak sama',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
if (model.globalKey.currentState!.validate()) {
|
||||
// remove keyboard
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
model.dialogService
|
||||
.showConfirmationDialog(
|
||||
title: 'Konfirmasi',
|
||||
description:
|
||||
'Apakah anda yakin ingin mengubah password?',
|
||||
cancelTitle: 'Batal',
|
||||
confirmationTitle: 'Ya',
|
||||
)
|
||||
.then(
|
||||
(response) async {
|
||||
if (response!.confirmed) {
|
||||
// completer!(DialogResponse(confirmed: true));
|
||||
// model.log.i('Password berhasil diubah');
|
||||
bool res = await model.gantiPassword();
|
||||
// model.log.i('res: $res');
|
||||
if (res) {
|
||||
completer!(DialogResponse(confirmed: true));
|
||||
model.log.i('Password berhasil diubah');
|
||||
}
|
||||
} else {
|
||||
model.log.i('Password gagal diubah');
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Simpan'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
completer!(DialogResponse(confirmed: false)),
|
||||
child: const Text(
|
||||
'Batal',
|
||||
style: TextStyle(color: dangerColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../app/app.logger.dart';
|
||||
import '../../../../../app/core/custom_base_view_model.dart';
|
||||
|
||||
class GantiPasswordDialogViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('GantiPasswordDialogViewModel');
|
||||
|
||||
// form variable
|
||||
final globalKey = GlobalKey<FormState>();
|
||||
TextEditingController passwordLamaController = TextEditingController();
|
||||
TextEditingController passwordBaruController = TextEditingController();
|
||||
TextEditingController konfirmasiPasswordBaruController =
|
||||
TextEditingController();
|
||||
|
||||
TextEditingController thePasswordLamaController = TextEditingController();
|
||||
|
||||
bool isPasswordLamaObscure = true;
|
||||
bool isPasswordBaruObscure = true;
|
||||
bool isKonfirmasiPasswordBaruObscure = true;
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = 'normalBack';
|
||||
String? passwordLama = await mySharedPrefs.getString('password');
|
||||
thePasswordLamaController.text = passwordLama!;
|
||||
}
|
||||
|
||||
Future<bool> gantiPassword() async {
|
||||
setBusy(true);
|
||||
|
||||
try {
|
||||
String? idCaleg = await mySharedPrefs.getString('id');
|
||||
var formData = FormData.fromMap({
|
||||
'id_caleg': idCaleg,
|
||||
'password_lama': passwordLamaController.text,
|
||||
'password_baru': passwordBaruController.text,
|
||||
});
|
||||
await httpService.postWithFormData('login/ganti_pass_caleg', formData);
|
||||
return true;
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
return false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../pengaturan_caleg_view.dart';
|
||||
import './pengaturan_caleg2_view_model.dart';
|
||||
|
||||
class PengaturanCaleg2View extends StatelessWidget {
|
||||
const PengaturanCaleg2View({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PengaturanCaleg2ViewModel>.nonReactive(
|
||||
viewModelBuilder: () => PengaturanCaleg2ViewModel(),
|
||||
onViewModelReady: (PengaturanCaleg2ViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
PengaturanCaleg2ViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return const PengaturanCalegView();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
import '../../../../../app/core/custom_base_view_model.dart';
|
||||
|
||||
class PengaturanCaleg2ViewModel extends CustomBaseViewModel {
|
||||
Future<void> init() async {}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../../../../app/themes/app_colors.dart';
|
||||
import '../../../../app/themes/app_text.dart';
|
||||
import '../../../widgets/top_container.dart';
|
||||
import './pengaturan_caleg_view_model.dart';
|
||||
|
||||
class PengaturanCalegView extends StatelessWidget {
|
||||
const PengaturanCalegView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PengaturanCalegViewModel>.reactive(
|
||||
viewModelBuilder: () => PengaturanCalegViewModel(),
|
||||
onViewModelReady: (PengaturanCalegViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
PengaturanCalegViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
// model.log.i('backPressed: ${model.globalVar.backPressed}');
|
||||
if (model.globalVar.backPressed == 'exitApp') {
|
||||
// model.back();
|
||||
model.quitApp(context);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TopContainer(
|
||||
title: 'Jumlah Suara',
|
||||
value: '${model.suaraCounter} Suara',
|
||||
icon: Icons.people_alt_outlined,
|
||||
background: warningColor,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TopContainer(
|
||||
title: 'Area\nTPS',
|
||||
value: '${model.suaraCounter} TPS',
|
||||
icon: Icons.location_on_outlined,
|
||||
background: orangeColor,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TopContainer(
|
||||
title: 'Jumlah Tim Survei',
|
||||
value: '${model.timSurverCounter} Orang',
|
||||
icon: Icons.co_present_outlined,
|
||||
background: greenColor,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
if (model.isBusy)
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
if (!model.isBusy && model.status == true)
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: 'Selamat Datang, ',
|
||||
style: regularTextStyle,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Caleg ${model.nama}\n\n',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Sila tekan menu',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: ' Hasil Suara ',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text:
|
||||
'untuk mengetahui jumlah suara.\n\nDan sila tekan menu',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: ' Tim Survei ',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text:
|
||||
'untuk mengetahui jumlah tim survei anda.\n\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Dan sila tekan menu',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: ' Area TPS ',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'untuk mengetahui Area TPS anda.\n\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text:
|
||||
'Jika terjadi kesalahan pada data, silahkan hubungi admin.\n\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Aplikasi dibuat oleh :',
|
||||
style: italicTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: ' Kicap Karan\n',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: mainColor,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: 'http://www.kicap-karan.com\n',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: mainColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (!model.isBusy && model.status == false)
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: 'Selamat Datang, ',
|
||||
style: regularTextStyle,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '${model.nama}\n',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Terjadi ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: 'Error ',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: redColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'pada saat mengambil data\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Silahkan coba lagi dengan menekan icon',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: ' Pengaturan\n',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'di pojok kanan bawah\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// with setting icon
|
||||
floatingActionButton: FloatingActionButton(
|
||||
backgroundColor: warningColor,
|
||||
onPressed: () {
|
||||
model.gantiPassword();
|
||||
},
|
||||
child: const Icon(Icons.settings, color: fontColor),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
import '../../../../app/app.dialogs.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../model/my_response.model.dart';
|
||||
|
||||
class PengaturanCalegViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('PengaturanCalegViewModel');
|
||||
|
||||
int timSurverCounter = 0;
|
||||
int suaraCounter = 0;
|
||||
int areaCounter = 0;
|
||||
bool status = false;
|
||||
String? nama;
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = 'exitApp';
|
||||
String? idCaleg = await mySharedPrefs.getString('id');
|
||||
nama = await mySharedPrefs.getString('nama');
|
||||
await getData(idCaleg!);
|
||||
}
|
||||
|
||||
getData(String idCaleg) async {
|
||||
setBusy(true);
|
||||
|
||||
try {
|
||||
var response = await httpService.get('caleg/detail/$idCaleg');
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
timSurverCounter = myResponseModel.data['jumlah_tim_survei'];
|
||||
suaraCounter = myResponseModel.data['jumlah_suara'];
|
||||
areaCounter = myResponseModel.data['jumlah_area'];
|
||||
status = true;
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
status = false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
gantiPassword() async {
|
||||
var res = await dialogService.showCustomDialog(
|
||||
variant: DialogType.gantiPasswordDialogView,
|
||||
title: 'Ganti Password',
|
||||
mainButtonTitle: 'Simpan',
|
||||
barrierDismissible: false,
|
||||
);
|
||||
|
||||
if (res!.confirmed) {
|
||||
snackbarService.showSnackbar(message: 'Password berhasil diubah');
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../../../../app/themes/app_colors.dart';
|
||||
import '../../../../app/themes/app_text.dart';
|
||||
import '../../../widgets/top_container.dart';
|
||||
import './tim_survei_view_model.dart';
|
||||
|
||||
class TimSurveiView extends StatelessWidget {
|
||||
const TimSurveiView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<TimSurveiViewModel>.reactive(
|
||||
viewModelBuilder: () => TimSurveiViewModel(),
|
||||
onViewModelReady: (TimSurveiViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
TimSurveiViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
// model.log.i('backPressed: ${model.globalVar.backPressed}');
|
||||
if (model.globalVar.backPressed == 'exitApp') {
|
||||
// model.back();
|
||||
model.quitApp(context);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
TopContainer(
|
||||
title: 'Tim\nSurvei',
|
||||
value: '${model.jumlahTimSurvei} Orang',
|
||||
icon: Icons.people_alt_outlined,
|
||||
background: orangeColor,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: model.isBusy
|
||||
? Alignment.center
|
||||
: (model.listTimSurveiModel.isNotEmpty
|
||||
? null
|
||||
: Alignment.center),
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: warningColor,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (model.isBusy)
|
||||
const Center(
|
||||
child: LinearProgressIndicator(
|
||||
minHeight: 5,
|
||||
color: mainColor,
|
||||
),
|
||||
),
|
||||
if (!model.isBusy &&
|
||||
model.listTimSurveiModel.isNotEmpty)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// create 10 list of survei person using card
|
||||
for (int i = 0;
|
||||
i < model.jumlahTimSurvei;
|
||||
i++)
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: Text('${i + 1}'),
|
||||
title: Text(
|
||||
model.listTimSurveiModel[i].nama!,
|
||||
),
|
||||
subtitle: Text(
|
||||
model.listTimSurveiModel[i].nik!,
|
||||
style: italicTextStyle,
|
||||
),
|
||||
trailing: IconButton(
|
||||
onPressed: () {
|
||||
model.checkSuara(model
|
||||
.listTimSurveiModel[i]);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.list_alt_outlined,
|
||||
color: mainColor,
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// if listTimSurveiModel is empty
|
||||
if (!model.isBusy &&
|
||||
model.listTimSurveiModel.isEmpty)
|
||||
Center(
|
||||
child: Text(
|
||||
model.status == true
|
||||
? 'Data Tim Survei Kosong\n'
|
||||
'Hubungi Admin Untuk\nTambahkan Tim Survei Baru'
|
||||
: 'Gagal Mengambil Data Tim Survei',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
import '../../../../app/app.bottomsheets.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../model/my_response.model.dart';
|
||||
import '../../../../model/tim_survei_model.dart';
|
||||
|
||||
class TimSurveiViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('TimSurveiViewModel');
|
||||
|
||||
// variabel
|
||||
List<TimSurveiModel> listTimSurveiModel = [];
|
||||
int jumlahTimSurvei = 0;
|
||||
bool status = false;
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = 'exitApp';
|
||||
String? idCaleg = await mySharedPrefs.getString('id');
|
||||
// log.i('idCaleg: $idCaleg');
|
||||
await getData(idCaleg!);
|
||||
}
|
||||
|
||||
getData(String idCaleg) async {
|
||||
setBusy(true);
|
||||
// easyLoading.showLoading();
|
||||
// globalVar.backPressed = 'cantBack';
|
||||
try {
|
||||
var response = await httpService.get('survei/caleg/$idCaleg');
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
// log.i('myResponseModel: ${myResponseModel.data}');
|
||||
TimSurveiListModel timSurveiListModel =
|
||||
TimSurveiListModel.fromJson(myResponseModel.data);
|
||||
// log.i('timSurveiListModel: ${timSurveiListModel.survei}');
|
||||
listTimSurveiModel = timSurveiListModel.survei ?? [];
|
||||
jumlahTimSurvei = timSurveiListModel.jumlah!;
|
||||
// log.i('listTimSurveiModel: $listTimSurveiModel');
|
||||
// log.i('jumlahTimSurvei: $jumlahTimSurvei');
|
||||
status = true;
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
status = false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
// globalVar.backPressed = 'exitApp';
|
||||
// easyLoading.dismissLoading();
|
||||
}
|
||||
}
|
||||
|
||||
checkSuara(TimSurveiModel timSurveiModel) async {
|
||||
await bottomSheetService.showCustomSheet(
|
||||
data: timSurveiModel.nik,
|
||||
barrierDismissible: true,
|
||||
isScrollControlled: true,
|
||||
title: 'Detail Suara Tim Survei ${timSurveiModel.nama}',
|
||||
description: 'Tim Survei',
|
||||
ignoreSafeArea: false,
|
||||
variant: BottomSheetType.detailSuaraBottomSheetView,
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import '../../../app/themes/app_colors.dart';
|
||||
import '../../../app/themes/app_text.dart';
|
||||
import './detail_suara_bottom_sheet_view_model.dart';
|
||||
|
||||
class DetailSuaraBottomSheetView extends StatelessWidget {
|
||||
final SheetRequest? request;
|
||||
final Function(SheetResponse)? completer;
|
||||
|
||||
const DetailSuaraBottomSheetView({
|
||||
Key? key,
|
||||
this.request,
|
||||
this.completer,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<DetailSuaraBottomSheetViewModel>.reactive(
|
||||
viewModelBuilder: () => DetailSuaraBottomSheetViewModel(),
|
||||
onViewModelReady: (DetailSuaraBottomSheetViewModel model) async {
|
||||
await model.init(request!);
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
DetailSuaraBottomSheetViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
padding: const EdgeInsets.all(20),
|
||||
alignment: Alignment.topCenter,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
request!.title!,
|
||||
style: italicTextStyle.copyWith(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
color: warningColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'Jumlah Suara: ${model.counter}',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (model.isBusy)
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
if (!model.isBusy &&
|
||||
model.status == true &&
|
||||
model.counter > 0)
|
||||
for (var i = 0; i < model.counter; i++)
|
||||
Card(
|
||||
child: ListTile(
|
||||
// leading is datetime dummy
|
||||
leading: Text(model.myFunction
|
||||
.convertDateTime2(
|
||||
model.listPemilih[i].createdAt!)),
|
||||
title: Text(
|
||||
model.listPemilih[i].namaPemilih!,
|
||||
style: boldTextStyle,
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (request!.description == 'Caleg')
|
||||
Text(
|
||||
model.listPemilih[i].namaTimSurvei!,
|
||||
style: italicTextStyle,
|
||||
),
|
||||
Text(
|
||||
model.listPemilih[i].namaArea!,
|
||||
),
|
||||
],
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.info_outline,
|
||||
color: mainColor,
|
||||
),
|
||||
onPressed: () {
|
||||
model.showDetailPemilih(
|
||||
model.listPemilih[i],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!model.isBusy &&
|
||||
model.status == true &&
|
||||
model.counter == 0)
|
||||
const Center(
|
||||
child: Text(
|
||||
'Belum ada data',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
),
|
||||
if (!model.isBusy && model.status == false)
|
||||
const Center(
|
||||
child: Text(
|
||||
'Error: Gagal mengambil data dari server',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
import '../../../app/app.bottomsheets.dart';
|
||||
import '../../../app/app.logger.dart';
|
||||
import '../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../model/my_response.model.dart';
|
||||
import '../../../model/pemilih_model.dart';
|
||||
|
||||
class DetailSuaraBottomSheetViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('DetailSuaraBottomSheetViewModel');
|
||||
bool status = false;
|
||||
|
||||
List<PemilihModel> listPemilih = [];
|
||||
int counter = 0;
|
||||
|
||||
Future<void> init(sheetRequest) async {
|
||||
String id = sheetRequest.data.toString();
|
||||
String status = sheetRequest.description;
|
||||
String? idCaleg = await mySharedPrefs.getString('id');
|
||||
await getData(id, status, idCaleg!);
|
||||
}
|
||||
|
||||
getData(String id, String status, String idCaleg) async {
|
||||
setBusy(true);
|
||||
|
||||
try {
|
||||
// var response = await httpService.get('caleg/suara/$id');
|
||||
String url = status == 'Tim Survei'
|
||||
? 'survei/suara/$id'
|
||||
: 'area/suara/$id/$idCaleg';
|
||||
|
||||
var response = await httpService.get(url);
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
PemilihDetailModel pemilihDetailModel =
|
||||
PemilihDetailModel.fromJson(myResponseModel.data);
|
||||
|
||||
listPemilih = pemilihDetailModel.pemilihModel!;
|
||||
counter = pemilihDetailModel.jumlah!;
|
||||
this.status = true;
|
||||
} catch (e) {
|
||||
this.status = false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
showDetailPemilih(PemilihModel listPemilih) async {
|
||||
await bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.detailSuaraPemilihBottomSheetView,
|
||||
title: 'Detail Suara Pemilih',
|
||||
description: 'Detail Suara Pemilih',
|
||||
// isScrollControlled: true,
|
||||
data: listPemilih,
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import '../../../../../app/themes/app_colors.dart';
|
||||
import '../../../../../app/themes/app_text.dart';
|
||||
import './detail_suara_pemilih_bottom_sheet_view_model.dart';
|
||||
|
||||
class DetailSuaraPemilihBottomSheetView extends StatelessWidget {
|
||||
final SheetRequest request;
|
||||
final Function(SheetResponse)? completer;
|
||||
|
||||
const DetailSuaraPemilihBottomSheetView({
|
||||
Key? key,
|
||||
required this.request,
|
||||
this.completer,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<DetailSuaraPemilihBottomSheetViewModel>.reactive(
|
||||
viewModelBuilder: () => DetailSuaraPemilihBottomSheetViewModel(),
|
||||
onViewModelReady: (DetailSuaraPemilihBottomSheetViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
DetailSuaraPemilihBottomSheetViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
padding: const EdgeInsets.all(20),
|
||||
alignment: Alignment.topCenter,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16.0),
|
||||
topRight: Radius.circular(16.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
request.title!,
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: fontColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Container(
|
||||
height: 100,
|
||||
width: 150,
|
||||
decoration: BoxDecoration(
|
||||
color: mainColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
model.showImage(
|
||||
context,
|
||||
dotenv.env['url']! + request.data!.img!,
|
||||
);
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Image.network(
|
||||
dotenv.env['url']! + request.data!.img!,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Center(
|
||||
child: Icon(
|
||||
Icons.error,
|
||||
color: backgroundColor,
|
||||
size: 50,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
_DetailChildWidget(
|
||||
title: 'Nama',
|
||||
value: request.data!.namaPemilih!,
|
||||
),
|
||||
_DetailChildWidget(
|
||||
title: 'No KTP /\nNo HP',
|
||||
value: request.data!.nikNomorHp!,
|
||||
),
|
||||
_DetailChildWidget(
|
||||
title: 'Tanggal/\nWaktu',
|
||||
value: model.myFunction
|
||||
.convertDateTime2(request.data!.createdAt!),
|
||||
),
|
||||
_DetailChildWidget(
|
||||
title: 'Caleg', value: request.data!.namaCaleg!),
|
||||
_DetailChildWidget(
|
||||
title: 'Tim Survei',
|
||||
value: request.data!.namaTimSurvei!,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DetailChildWidget extends StatelessWidget {
|
||||
const _DetailChildWidget({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.value,
|
||||
}) : super(key: key);
|
||||
final String title;
|
||||
final String value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
title,
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: fontColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
' : ',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: fontColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Text(
|
||||
value,
|
||||
style: italicTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: fontColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import 'package:easy_image_viewer/easy_image_viewer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../app/app.logger.dart';
|
||||
import '../../../../../app/core/custom_base_view_model.dart';
|
||||
|
||||
class DetailSuaraPemilihBottomSheetViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('DetailSuaraPemilihBottomSheetViewModel');
|
||||
Future<void> init() async {}
|
||||
|
||||
showImage(BuildContext context, String? url) async {
|
||||
log.i(url);
|
||||
showImageViewer(
|
||||
context,
|
||||
Image.network(
|
||||
url!,
|
||||
fit: BoxFit.fill,
|
||||
).image,
|
||||
swipeDismissible: true,
|
||||
doubleTapZoomable: true,
|
||||
);
|
||||
}
|
||||
}
|
129
lib/ui/views/login_screen/login_screen_view.dart
Normal file
129
lib/ui/views/login_screen/login_screen_view.dart
Normal file
@ -0,0 +1,129 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:validatorless/validatorless.dart';
|
||||
|
||||
import '../../../app/themes/app_colors.dart';
|
||||
import '../../../app/themes/app_text.dart';
|
||||
import '../../widgets/my_button.dart';
|
||||
import '../../widgets/my_textformfield.dart';
|
||||
import './login_screen_view_model.dart';
|
||||
|
||||
class LoginScreenView extends StatelessWidget {
|
||||
const LoginScreenView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<LoginScreenViewModel>.reactive(
|
||||
viewModelBuilder: () => LoginScreenViewModel(),
|
||||
onViewModelReady: (LoginScreenViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
LoginScreenViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
backgroundColor: warningColor,
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
model.log.i('backPressed: ${model.globalVar.backPressed}');
|
||||
if (model.globalVar.backPressed == 'backNormal') {
|
||||
// model.back();
|
||||
model.quitApp(context);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||
child: SingleChildScrollView(
|
||||
child: Form(
|
||||
key: model.formKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
Center(
|
||||
child: Image.asset(
|
||||
'assets/logo.png',
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const Text(
|
||||
'Halaman Login',
|
||||
),
|
||||
const Text(
|
||||
'(Caleg App)',
|
||||
style: italicTextStyle,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyTextFormField(
|
||||
controller: model.usernameController,
|
||||
labelText: 'Username',
|
||||
hintText: 'Masukkan Username',
|
||||
suffixIcon: const Icon(Icons.person),
|
||||
validator: Validatorless.required(
|
||||
'Username tidak boleh kosong'),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
MyTextFormField(
|
||||
controller: model.passwordController,
|
||||
hintText: 'Masukkan Password',
|
||||
labelText: 'Password',
|
||||
suffixIcon: GestureDetector(
|
||||
child: model.isPasswordVisible
|
||||
? const Icon(Icons.visibility)
|
||||
: const Icon(Icons.visibility_off),
|
||||
onTap: () {
|
||||
model.isPasswordVisible =
|
||||
!model.isPasswordVisible;
|
||||
model.log.i(
|
||||
'isPasswordVisible: ${model.isPasswordVisible}');
|
||||
model.notifyListeners();
|
||||
},
|
||||
),
|
||||
obscureText: !model.isPasswordVisible,
|
||||
validator: Validatorless.required(
|
||||
'Password tidak boleh kosong'),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: MyButton(
|
||||
// theBackgroundColor: lightColor,
|
||||
textColor: fontColor,
|
||||
text: 'Login',
|
||||
onPressed: () {
|
||||
if (model.formKey.currentState!.validate()) {
|
||||
model.login();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
64
lib/ui/views/login_screen/login_screen_view_model.dart
Normal file
64
lib/ui/views/login_screen/login_screen_view_model.dart
Normal file
@ -0,0 +1,64 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../app/app.router.dart';
|
||||
import '../../../app/app.logger.dart';
|
||||
import '../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../model/caleg_model.dart';
|
||||
import '../../../model/my_response.model.dart';
|
||||
|
||||
class LoginScreenViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('LoginScreenViewModel');
|
||||
|
||||
// variable
|
||||
final formKey = GlobalKey<FormState>();
|
||||
TextEditingController usernameController = TextEditingController();
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
bool isPasswordVisible = false;
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = 'backNormal';
|
||||
}
|
||||
|
||||
login() async {
|
||||
easyLoading.customLoading('Login..');
|
||||
globalVar.backPressed = 'cantBack';
|
||||
|
||||
try {
|
||||
var formData = FormData.fromMap({
|
||||
'username': usernameController.text,
|
||||
'password': passwordController.text,
|
||||
});
|
||||
var response =
|
||||
await httpService.postWithFormData('login/caleg', formData);
|
||||
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
var data = myResponseModel.data;
|
||||
CalegModel calegModel = CalegModel.fromJson(data);
|
||||
// log.i('calegModel: ${calegModel.toJson()}');
|
||||
await mySharedPrefs.setString('id', calegModel.idCaleg!.toString());
|
||||
await mySharedPrefs.setString('nama', calegModel.namaCaleg!);
|
||||
await mySharedPrefs.setString(
|
||||
'nomorUrut', calegModel.nomorUrutCaleg!.toString());
|
||||
await mySharedPrefs.setString('foto', calegModel.foto!);
|
||||
await mySharedPrefs.setString('level', 'caleg');
|
||||
await mySharedPrefs.setString('password', passwordController.text);
|
||||
|
||||
snackbarService.showSnackbar(
|
||||
message:
|
||||
'Selamat datang kembali Calon Legislatif ${calegModel.namaCaleg}',
|
||||
title: 'Login Berhasil',
|
||||
duration: const Duration(milliseconds: 2500),
|
||||
);
|
||||
navigationService.navigateToCalegIndexTrackingView();
|
||||
} catch (e) {
|
||||
log.e('error: $e');
|
||||
} finally {
|
||||
easyLoading.dismissLoading();
|
||||
globalVar.backPressed = 'backNormal';
|
||||
}
|
||||
|
||||
// navigationService.pushNamedAndRemoveUntil('/home-screen');
|
||||
// await navigationService.navigateToAdminIndexTrackingView();
|
||||
}
|
||||
}
|
92
lib/ui/views/splash_screen/splash_screen_view.dart
Normal file
92
lib/ui/views/splash_screen/splash_screen_view.dart
Normal file
@ -0,0 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../../../app/themes/app_colors.dart';
|
||||
import '../../../app/themes/app_text.dart';
|
||||
import './splash_screen_view_model.dart';
|
||||
|
||||
class SplashScreenView extends StatelessWidget {
|
||||
const SplashScreenView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<SplashScreenViewModel>.reactive(
|
||||
viewModelBuilder: () => SplashScreenViewModel(),
|
||||
onViewModelReady: (SplashScreenViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
SplashScreenViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
backgroundColor: warningColor,
|
||||
body: SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Expanded(
|
||||
flex: 1,
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
'assets/logo.png',
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'SISTEM CEK SUARA',
|
||||
style: boldTextStyle.copyWith(
|
||||
// color: backgroundColor,
|
||||
fontSize: 20,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
'(Survei App)',
|
||||
style: boldTextStyle.copyWith(
|
||||
// color: backgroundColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const Expanded(child: SizedBox()),
|
||||
Text(
|
||||
'Created By',
|
||||
style: regularTextStyle.copyWith(
|
||||
fontSize: 12,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
'Kicap Karan',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
'www.kicap-karan.com',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
13
lib/ui/views/splash_screen/splash_screen_view_model.dart
Normal file
13
lib/ui/views/splash_screen/splash_screen_view_model.dart
Normal file
@ -0,0 +1,13 @@
|
||||
import '../../../app/app.logger.dart';
|
||||
import '../../../app/app.router.dart';
|
||||
import '../../../app/core/custom_base_view_model.dart';
|
||||
|
||||
class SplashScreenViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('SplashScreenViewModel');
|
||||
Future<void> init() async {
|
||||
// await 3 seconds then go to login
|
||||
await mySharedPrefs.clear();
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
await navigationService.navigateTo(Routes.loginScreenView);
|
||||
}
|
||||
}
|
38
lib/ui/widgets/my_button.dart
Normal file
38
lib/ui/widgets/my_button.dart
Normal file
@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../app/themes/app_colors.dart';
|
||||
|
||||
class MyButton extends StatelessWidget {
|
||||
const MyButton({
|
||||
Key? key,
|
||||
required this.text,
|
||||
this.theBackgroundColor = mainColor,
|
||||
this.textColor = backgroundColor,
|
||||
this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
final String text;
|
||||
final VoidCallback? onPressed;
|
||||
final Color theBackgroundColor;
|
||||
final Color textColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: theBackgroundColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
85
lib/ui/widgets/my_textformfield.dart
Normal file
85
lib/ui/widgets/my_textformfield.dart
Normal file
@ -0,0 +1,85 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../app/themes/app_colors.dart';
|
||||
|
||||
class MyTextFormField extends StatelessWidget {
|
||||
const MyTextFormField({
|
||||
Key? key,
|
||||
this.labelText,
|
||||
this.hintText,
|
||||
this.obscureText,
|
||||
this.validator,
|
||||
this.suffixIcon,
|
||||
this.prefixIcon,
|
||||
this.focusNode,
|
||||
this.controller,
|
||||
this.maxLines = 1,
|
||||
this.onEditingComplete,
|
||||
this.keyboardType = TextInputType.text,
|
||||
this.initialValue,
|
||||
this.readOnly = false,
|
||||
this.maxLength,
|
||||
}) : super(key: key);
|
||||
|
||||
final String? labelText;
|
||||
final String? hintText;
|
||||
final bool? obscureText;
|
||||
final FormFieldValidator<String>? validator;
|
||||
final Widget? suffixIcon;
|
||||
final Widget? prefixIcon;
|
||||
final FocusNode? focusNode;
|
||||
final TextEditingController? controller;
|
||||
final int maxLines;
|
||||
final VoidCallback? onEditingComplete;
|
||||
final TextInputType keyboardType;
|
||||
final String? initialValue;
|
||||
final bool readOnly;
|
||||
final int? maxLength;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
maxLength: maxLength,
|
||||
readOnly: readOnly,
|
||||
initialValue: initialValue,
|
||||
onEditingComplete: onEditingComplete,
|
||||
maxLines: maxLines,
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
obscureText: obscureText ?? false,
|
||||
keyboardType: keyboardType,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: prefixIcon,
|
||||
suffixIcon: suffixIcon,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(25)),
|
||||
borderSide: BorderSide(
|
||||
// color: mainColor,
|
||||
),
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(25)),
|
||||
borderSide: BorderSide(
|
||||
// color: mainColor,
|
||||
),
|
||||
),
|
||||
focusedErrorBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(25)),
|
||||
borderSide: BorderSide(
|
||||
color: dangerColor,
|
||||
),
|
||||
),
|
||||
errorBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(25)),
|
||||
borderSide: BorderSide(
|
||||
color: dangerColor,
|
||||
),
|
||||
),
|
||||
labelText: labelText,
|
||||
hintText: hintText,
|
||||
labelStyle: const TextStyle(color: fontColor),
|
||||
),
|
||||
validator: validator,
|
||||
);
|
||||
}
|
||||
}
|
73
lib/ui/widgets/top_container.dart
Normal file
73
lib/ui/widgets/top_container.dart
Normal file
@ -0,0 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../app/themes/app_colors.dart';
|
||||
|
||||
class TopContainer extends StatelessWidget {
|
||||
const TopContainer({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.value,
|
||||
required this.icon,
|
||||
required this.background,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String value;
|
||||
final IconData icon;
|
||||
final Color background;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: background,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
color: fontGrey,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.justify,
|
||||
),
|
||||
),
|
||||
const Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
':',
|
||||
style: TextStyle(
|
||||
color: fontGrey,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
color: fontGrey,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
icon,
|
||||
color: fontGrey,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
938
pubspec.lock
Normal file
938
pubspec.lock
Normal file
@ -0,0 +1,938 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
_fe_analyzer_shared:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: _fe_analyzer_shared
|
||||
sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "61.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.13.0"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.2"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.11.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build
|
||||
sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_config
|
||||
sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
build_daemon:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_daemon
|
||||
sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
build_resolvers:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_resolvers
|
||||
sha256: "64e12b0521812d1684b1917bc80945625391cb9bdd4312536b1d69dcb6133ed8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
build_runner:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.6"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_runner_core
|
||||
sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.2.11"
|
||||
built_collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_collection
|
||||
sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.1"
|
||||
built_value:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_value
|
||||
sha256: "723b4021e903217dfc445ec4cf5b42e27975aece1fc4ebbc1ca6329c2d9fb54e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.7.0"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
checked_yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: checked_yaml
|
||||
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_builder
|
||||
sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.7.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.2"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cross_file
|
||||
sha256: "445db18de832dba8d851e287aff8ccf169bed30d2e94243cb54c7d2f1ed2142c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.3+6"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.6"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
dio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dio
|
||||
sha256: "417e2a6f9d83ab396ec38ff4ea5da6c254da71e4db765ad737a42af6930140b7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.3.3"
|
||||
easy_image_viewer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: easy_image_viewer
|
||||
sha256: "8d11a4630e9beb7aacf043c98da2dd4b3bc3b47aa4073d2016ba696376161272"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
file_selector_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_linux
|
||||
sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.2+1"
|
||||
file_selector_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_macos
|
||||
sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.3+3"
|
||||
file_selector_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_platform_interface
|
||||
sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.6.1"
|
||||
file_selector_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_selector_windows
|
||||
sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.3+1"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_dotenv:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_dotenv
|
||||
sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
flutter_easyloading:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_easyloading
|
||||
sha256: ba21a3c883544e582f9cc455a4a0907556714e1e9cf0eababfcb600da191d17c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.5"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
flutter_plugin_android_lifecycle:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_plugin_android_lifecycle
|
||||
sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.17"
|
||||
flutter_spinkit:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_spinkit
|
||||
sha256: b39c753e909d4796906c5696a14daf33639a76e017136c8d82bf3e620ce5bb8e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.2.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
freezed_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: freezed_annotation
|
||||
sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: frontend_server_client
|
||||
sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.0"
|
||||
get:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: get
|
||||
sha256: "2ba20a47c8f1f233bed775ba2dd0d3ac97b4cf32fc17731b3dfc672b06b0e92a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.6.5"
|
||||
get_it:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: get_it
|
||||
sha256: f79870884de16d689cf9a7d15eedf31ed61d750e813c538a6efb92660fea83c3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.6.4"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: glob
|
||||
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
graphs:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: graphs
|
||||
sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_multi_server
|
||||
sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.1"
|
||||
http_parser:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: http_parser
|
||||
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
image_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: image_picker
|
||||
sha256: b6951e25b795d053a6ba03af5f710069c99349de9341af95155d52665cb4607c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.9"
|
||||
image_picker_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image_picker_android
|
||||
sha256: d6a6e78821086b0b737009b09363018309bbc6de3fd88cc5c26bc2bb44a4957f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.8+2"
|
||||
image_picker_for_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image_picker_for_web
|
||||
sha256: "869fe8a64771b7afbc99fc433a5f7be2fea4d1cb3d7c11a48b6b579eb9c797f0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
image_picker_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image_picker_ios
|
||||
sha256: "76ec722aeea419d03aa915c2c96bf5b47214b053899088c9abb4086ceecf97a7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.8+4"
|
||||
image_picker_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image_picker_linux
|
||||
sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.1+1"
|
||||
image_picker_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image_picker_macos
|
||||
sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.1+1"
|
||||
image_picker_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image_picker_platform_interface
|
||||
sha256: ed9b00e63977c93b0d2d2b343685bed9c324534ba5abafbb3dfbd6a780b1b514
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.9.1"
|
||||
image_picker_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image_picker_windows
|
||||
sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.1+1"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.18.1"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: io
|
||||
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.7"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.8.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
logger:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logger
|
||||
sha256: "7ad7215c15420a102ec687bb320a7312afd449bac63bfb1c60d9787c27b9767f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.16"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: mime
|
||||
sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.3"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin_platform_interface
|
||||
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.6"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pool
|
||||
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: provider
|
||||
sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.5"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pub_semver
|
||||
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
pubspec_parse:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pubspec_parse
|
||||
sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.3"
|
||||
recase:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: recase
|
||||
sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: shared_preferences
|
||||
sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
shared_preferences_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_android
|
||||
sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
shared_preferences_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_foundation
|
||||
sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.4"
|
||||
shared_preferences_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_linux
|
||||
sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
shared_preferences_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_platform_interface
|
||||
sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
shared_preferences_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_web
|
||||
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
shared_preferences_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shared_preferences_windows
|
||||
sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf
|
||||
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
shelf_web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
source_gen:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_gen
|
||||
sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
stacked:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: stacked
|
||||
sha256: "9b314261e675b6d153caee14c3e8fc4590e8a8f3fdd0f418d545c5963372a46f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.4.1+1"
|
||||
stacked_generator:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: stacked_generator
|
||||
sha256: c141baf56cb7168dfde142d3578118c7bf914be9fb62bc8593344e97894ac8f9
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
stacked_services:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: stacked_services
|
||||
sha256: df2780a026fd1d3671aceaa9d7cae9e8d15d577c71ef29d7dd6f79a0a289e77e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.12"
|
||||
stacked_shared:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stacked_shared
|
||||
sha256: e6bc2921eb59b7c741c551fbb4060f22a543ea9c2d9351315fb58aa055b535f3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_transform
|
||||
sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
stylish_bottom_bar:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: stylish_bottom_bar
|
||||
sha256: "54970e4753b4273239b6dea0d1175c56beabcf39b5c65df4cbf86f1b86568d2b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.0"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: timing
|
||||
sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
universal_io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: universal_io
|
||||
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
validatorless:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: validatorless
|
||||
sha256: ddb46df636114b3322d289489164cac309767b157191ba43c7ad49b28c2b57c7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.3"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: watcher
|
||||
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket_channel
|
||||
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.0"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.9"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.1.0-163.1.beta <4.0.0"
|
||||
flutter: ">=3.7.0"
|
105
pubspec.yaml
Normal file
105
pubspec.yaml
Normal file
@ -0,0 +1,105 @@
|
||||
name: cek_suara_caleg
|
||||
description: A new Flutter project.
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=3.1.0-163.1.beta <4.0.0'
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
||||
# dependencies can be manually updated by changing the version numbers below to
|
||||
# the latest version available on pub.dev. To see which dependencies have newer
|
||||
# versions available, run `flutter pub outdated`.
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
stacked: ^3.0.1
|
||||
stacked_services: ^0.9.8
|
||||
flutter_dotenv:
|
||||
image_picker: ^0.8.5
|
||||
path_provider: ^2.0.9
|
||||
dio:
|
||||
flutter_easyloading:
|
||||
stylish_bottom_bar:
|
||||
validatorless: ^1.2.3
|
||||
http_parser:
|
||||
intl:
|
||||
shared_preferences:
|
||||
easy_image_viewer:
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^2.0.0
|
||||
build_runner:
|
||||
stacked_generator:
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
assets:
|
||||
- .env
|
||||
- assets/logo.png
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
|
||||
# To add custom fonts to your application, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
30
test/widget_test.dart
Normal file
30
test/widget_test.dart
Normal file
@ -0,0 +1,30 @@
|
||||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:cek_suara_caleg/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user