first commit
This commit is contained in:
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/pengembang_index/pengembang_home/tambah_rumah_bottom_sheet/tambah_rumah_bottom_sheet_view.dart';
|
||||
import '../ui/views/tambah_lihat_progress_bottom_sheet/tambah_lihat_progress_bottom_sheet_view.dart';
|
||||
|
||||
enum BottomSheetType {
|
||||
tambahRumahBottomSheetView,
|
||||
tambahLihatProgressBottomSheetView,
|
||||
}
|
||||
|
||||
void setupBottomSheetUi() {
|
||||
final bottomsheetService = locator<BottomSheetService>();
|
||||
|
||||
final Map<BottomSheetType, SheetBuilder> builders = {
|
||||
BottomSheetType.tambahRumahBottomSheetView: (context, request, completer) =>
|
||||
TambahRumahBottomSheetView(request: request, completer: completer),
|
||||
BottomSheetType.tambahLihatProgressBottomSheetView:
|
||||
(context, request, completer) => TambahLihatProgressBottomSheetView(
|
||||
request: request, completer: completer),
|
||||
};
|
||||
|
||||
bottomsheetService.setCustomSheetBuilders(builders);
|
||||
}
|
||||
80
lib/app/app.dart
Normal file
80
lib/app/app.dart
Normal file
@ -0,0 +1,80 @@
|
||||
import 'package:perumahan_bew/ui/views/play_video_dialog/play_video_dialog_view.dart';
|
||||
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/login_screen/login_screen_view.dart';
|
||||
import '../ui/views/mandor_tracking_index/mandor_tracking_index_view.dart';
|
||||
import '../ui/views/pengembang_index/list_pemilik/list_pemilik_view.dart';
|
||||
import '../ui/views/pengembang_index/pengembang_home/pengembang_home2/pengembang_home2_view.dart';
|
||||
import '../ui/views/pengembang_index/pengembang_home/pengembang_home_view.dart';
|
||||
import '../ui/views/pengembang_index/pengembang_home/tambah_rumah_bottom_sheet/tambah_rumah_bottom_sheet_view.dart';
|
||||
import '../ui/views/pengembang_index/pengembang_index_view.dart';
|
||||
import '../ui/views/pengembang_index/pengembang_profil/pengembang_profil_view.dart';
|
||||
import '../ui/views/pengembang_index/perumahan_detail/perumahan_detail_view.dart';
|
||||
import '../ui/views/splash_screen/splash_screen_view.dart';
|
||||
import '../ui/views/tambah_lihat_progress_bottom_sheet/tambah_lihat_progress_bottom_sheet_view.dart';
|
||||
import '../ui/views/user_index/user_home/user_home_view.dart';
|
||||
import '../ui/views/user_index/user_index_view.dart';
|
||||
import '../ui/views/user_index/user_list_pembangunan/user_list_pembangunan_view.dart';
|
||||
import '../ui/views/user_index/user_profile/user_profile_view.dart';
|
||||
|
||||
@StackedApp(
|
||||
routes: [
|
||||
MaterialRoute(page: SplashScreenView, initial: true),
|
||||
MaterialRoute(page: LoginScreenView),
|
||||
MaterialRoute(
|
||||
page: UserIndexView,
|
||||
children: [
|
||||
MaterialRoute(page: UserHomeView, initial: true),
|
||||
MaterialRoute(page: UserProfileView),
|
||||
MaterialRoute(page: UserListPembangunanView),
|
||||
],
|
||||
),
|
||||
// dibawah untuk admin
|
||||
MaterialRoute(
|
||||
page: PengembangIndexView,
|
||||
children: [
|
||||
MaterialRoute(page: PengembangHomeView, initial: true),
|
||||
MaterialRoute(page: PengembangHome2View),
|
||||
MaterialRoute(page: ListPemilikView),
|
||||
MaterialRoute(page: PengembangProfilView),
|
||||
],
|
||||
),
|
||||
MaterialRoute(page: PerumahanDetailView),
|
||||
// dibawah untuk mandor
|
||||
MaterialRoute(page: MandorTrackingIndexView, children: [
|
||||
MaterialRoute(page: PengembangHomeView, initial: true),
|
||||
MaterialRoute(page: PengembangHome2View),
|
||||
MaterialRoute(page: ListPemilikView),
|
||||
MaterialRoute(page: PengembangProfilView),
|
||||
])
|
||||
],
|
||||
dependencies: [
|
||||
LazySingleton(classType: NavigationService),
|
||||
LazySingleton(classType: DialogService),
|
||||
LazySingleton(classType: SnackbarService),
|
||||
LazySingleton(classType: BottomSheetService),
|
||||
//
|
||||
LazySingleton(classType: UserHomeView),
|
||||
LazySingleton(classType: PengembangHomeView),
|
||||
LazySingleton(classType: MyEasyLoading),
|
||||
LazySingleton(classType: MyHttpServices),
|
||||
LazySingleton(classType: MySharedPrefs),
|
||||
LazySingleton(classType: GlobalVar),
|
||||
LazySingleton(classType: MyFunction),
|
||||
],
|
||||
bottomsheets: [
|
||||
StackedBottomsheet(classType: TambahRumahBottomSheetView),
|
||||
StackedBottomsheet(classType: TambahLihatProgressBottomSheetView),
|
||||
],
|
||||
dialogs: [
|
||||
StackedDialog(classType: PlayVideoDialogView),
|
||||
],
|
||||
logger: StackedLogger(),
|
||||
)
|
||||
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/play_video_dialog/play_video_dialog_view.dart';
|
||||
|
||||
enum DialogType {
|
||||
playVideoDialogView,
|
||||
}
|
||||
|
||||
void setupDialogUi() {
|
||||
final dialogService = locator<DialogService>();
|
||||
|
||||
final Map<DialogType, DialogBuilder> builders = {
|
||||
DialogType.playVideoDialogView: (context, request, completer) =>
|
||||
PlayVideoDialogView(request: request, completer: completer),
|
||||
};
|
||||
|
||||
dialogService.registerCustomDialogBuilders(builders);
|
||||
}
|
||||
45
lib/app/app.locator.dart
Normal file
45
lib/app/app.locator.dart
Normal file
@ -0,0 +1,45 @@
|
||||
// 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';
|
||||
import '../ui/views/pengembang_index/pengembang_home/pengembang_home_view.dart';
|
||||
import '../ui/views/user_index/user_home/user_home_view.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(() => const UserHomeView());
|
||||
locator.registerLazySingleton(() => const PengembangHomeView());
|
||||
locator.registerLazySingleton(() => MyEasyLoading());
|
||||
locator.registerLazySingleton(() => MyHttpServices());
|
||||
locator.registerLazySingleton(() => MySharedPrefs());
|
||||
locator.registerLazySingleton(() => GlobalVar());
|
||||
locator.registerLazySingleton(() => MyFunction());
|
||||
}
|
||||
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(),
|
||||
]),
|
||||
);
|
||||
}
|
||||
868
lib/app/app.router.dart
Normal file
868
lib/app/app.router.dart
Normal file
@ -0,0 +1,868 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// StackedNavigatorGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:flutter/material.dart' as _i8;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:perumahan_bew/ui/views/login_screen/login_screen_view.dart'
|
||||
as _i3;
|
||||
import 'package:perumahan_bew/ui/views/mandor_tracking_index/mandor_tracking_index_view.dart'
|
||||
as _i7;
|
||||
import 'package:perumahan_bew/ui/views/pengembang_index/list_pemilik/list_pemilik_view.dart'
|
||||
as _i14;
|
||||
import 'package:perumahan_bew/ui/views/pengembang_index/pengembang_home/pengembang_home2/pengembang_home2_view.dart'
|
||||
as _i13;
|
||||
import 'package:perumahan_bew/ui/views/pengembang_index/pengembang_home/pengembang_home_view.dart'
|
||||
as _i12;
|
||||
import 'package:perumahan_bew/ui/views/pengembang_index/pengembang_index_view.dart'
|
||||
as _i5;
|
||||
import 'package:perumahan_bew/ui/views/pengembang_index/pengembang_profil/pengembang_profil_view.dart'
|
||||
as _i15;
|
||||
import 'package:perumahan_bew/ui/views/pengembang_index/perumahan_detail/perumahan_detail_view.dart'
|
||||
as _i6;
|
||||
import 'package:perumahan_bew/ui/views/splash_screen/splash_screen_view.dart'
|
||||
as _i2;
|
||||
import 'package:perumahan_bew/ui/views/user_index/user_home/user_home_view.dart'
|
||||
as _i9;
|
||||
import 'package:perumahan_bew/ui/views/user_index/user_index_view.dart' as _i4;
|
||||
import 'package:perumahan_bew/ui/views/user_index/user_list_pembangunan/user_list_pembangunan_view.dart'
|
||||
as _i11;
|
||||
import 'package:perumahan_bew/ui/views/user_index/user_profile/user_profile_view.dart'
|
||||
as _i10;
|
||||
import 'package:stacked/stacked.dart' as _i1;
|
||||
import 'package:stacked_services/stacked_services.dart' as _i16;
|
||||
|
||||
class Routes {
|
||||
static const splashScreenView = '/';
|
||||
|
||||
static const loginScreenView = '/login-screen-view';
|
||||
|
||||
static const userIndexView = '/user-index-view';
|
||||
|
||||
static const pengembangIndexView = '/pengembang-index-view';
|
||||
|
||||
static const perumahanDetailView = '/perumahan-detail-view';
|
||||
|
||||
static const mandorTrackingIndexView = '/mandor-tracking-index-view';
|
||||
|
||||
static const all = <String>{
|
||||
splashScreenView,
|
||||
loginScreenView,
|
||||
userIndexView,
|
||||
pengembangIndexView,
|
||||
perumahanDetailView,
|
||||
mandorTrackingIndexView,
|
||||
};
|
||||
}
|
||||
|
||||
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.userIndexView,
|
||||
page: _i4.UserIndexView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
Routes.pengembangIndexView,
|
||||
page: _i5.PengembangIndexView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
Routes.perumahanDetailView,
|
||||
page: _i6.PerumahanDetailView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
Routes.mandorTrackingIndexView,
|
||||
page: _i7.MandorTrackingIndexView,
|
||||
),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i2.SplashScreenView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i2.SplashScreenView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i3.LoginScreenView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i3.LoginScreenView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i4.UserIndexView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i4.UserIndexView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i5.PengembangIndexView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i5.PengembangIndexView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i6.PerumahanDetailView: (data) {
|
||||
final args = data.getArgs<PerumahanDetailViewArguments>(nullOk: false);
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => _i6.PerumahanDetailView(
|
||||
key: args.key, idPerumahan: args.idPerumahan),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i7.MandorTrackingIndexView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i7.MandorTrackingIndexView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
List<_i1.RouteDef> get routes => _routes;
|
||||
|
||||
@override
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
class PerumahanDetailViewArguments {
|
||||
const PerumahanDetailViewArguments({
|
||||
this.key,
|
||||
required this.idPerumahan,
|
||||
});
|
||||
|
||||
final _i8.Key? key;
|
||||
|
||||
final String idPerumahan;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return '{"key": "$key", "idPerumahan": "$idPerumahan"}';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(covariant PerumahanDetailViewArguments other) {
|
||||
if (identical(this, other)) return true;
|
||||
return other.key == key && other.idPerumahan == idPerumahan;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return key.hashCode ^ idPerumahan.hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
class UserIndexViewRoutes {
|
||||
static const userHomeView = '';
|
||||
|
||||
static const userProfileView = 'user-profile-view';
|
||||
|
||||
static const userListPembangunanView = 'user-list-pembangunan-view';
|
||||
|
||||
static const all = <String>{
|
||||
userHomeView,
|
||||
userProfileView,
|
||||
userListPembangunanView,
|
||||
};
|
||||
}
|
||||
|
||||
class UserIndexViewRouter extends _i1.RouterBase {
|
||||
final _routes = <_i1.RouteDef>[
|
||||
_i1.RouteDef(
|
||||
UserIndexViewRoutes.userHomeView,
|
||||
page: _i9.UserHomeView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
UserIndexViewRoutes.userProfileView,
|
||||
page: _i10.UserProfileView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
UserIndexViewRoutes.userListPembangunanView,
|
||||
page: _i11.UserListPembangunanView,
|
||||
),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i9.UserHomeView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i9.UserHomeView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i10.UserProfileView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i10.UserProfileView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i11.UserListPembangunanView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i11.UserListPembangunanView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
List<_i1.RouteDef> get routes => _routes;
|
||||
|
||||
@override
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
class PengembangIndexViewRoutes {
|
||||
static const pengembangHomeView = '';
|
||||
|
||||
static const pengembangHome2View = 'pengembang-home2-view';
|
||||
|
||||
static const listPemilikView = 'list-pemilik-view';
|
||||
|
||||
static const pengembangProfilView = 'pengembang-profil-view';
|
||||
|
||||
static const all = <String>{
|
||||
pengembangHomeView,
|
||||
pengembangHome2View,
|
||||
listPemilikView,
|
||||
pengembangProfilView,
|
||||
};
|
||||
}
|
||||
|
||||
class PengembangIndexViewRouter extends _i1.RouterBase {
|
||||
final _routes = <_i1.RouteDef>[
|
||||
_i1.RouteDef(
|
||||
PengembangIndexViewRoutes.pengembangHomeView,
|
||||
page: _i12.PengembangHomeView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
PengembangIndexViewRoutes.pengembangHome2View,
|
||||
page: _i13.PengembangHome2View,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
PengembangIndexViewRoutes.listPemilikView,
|
||||
page: _i14.ListPemilikView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
PengembangIndexViewRoutes.pengembangProfilView,
|
||||
page: _i15.PengembangProfilView,
|
||||
),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i12.PengembangHomeView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i12.PengembangHomeView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i13.PengembangHome2View: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i13.PengembangHome2View(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i14.ListPemilikView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i14.ListPemilikView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i15.PengembangProfilView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i15.PengembangProfilView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
List<_i1.RouteDef> get routes => _routes;
|
||||
|
||||
@override
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
class MandorTrackingIndexViewRoutes {
|
||||
static const pengembangHomeView = '';
|
||||
|
||||
static const pengembangHome2View = 'pengembang-home2-view';
|
||||
|
||||
static const listPemilikView = 'list-pemilik-view';
|
||||
|
||||
static const pengembangProfilView = 'pengembang-profil-view';
|
||||
|
||||
static const all = <String>{
|
||||
pengembangHomeView,
|
||||
pengembangHome2View,
|
||||
listPemilikView,
|
||||
pengembangProfilView,
|
||||
};
|
||||
}
|
||||
|
||||
class MandorTrackingIndexViewRouter extends _i1.RouterBase {
|
||||
final _routes = <_i1.RouteDef>[
|
||||
_i1.RouteDef(
|
||||
MandorTrackingIndexViewRoutes.pengembangHomeView,
|
||||
page: _i12.PengembangHomeView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
MandorTrackingIndexViewRoutes.pengembangHome2View,
|
||||
page: _i13.PengembangHome2View,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
MandorTrackingIndexViewRoutes.listPemilikView,
|
||||
page: _i14.ListPemilikView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
MandorTrackingIndexViewRoutes.pengembangProfilView,
|
||||
page: _i15.PengembangProfilView,
|
||||
),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i12.PengembangHomeView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i12.PengembangHomeView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i13.PengembangHome2View: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i13.PengembangHome2View(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i14.ListPemilikView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i14.ListPemilikView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i15.PengembangProfilView: (data) {
|
||||
return _i8.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i15.PengembangProfilView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
List<_i1.RouteDef> get routes => _routes;
|
||||
|
||||
@override
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
extension NavigatorStateExtension on _i16.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> navigateToUserIndexView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(Routes.userIndexView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToPengembangIndexView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(Routes.pengembangIndexView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToPerumahanDetailView({
|
||||
_i8.Key? key,
|
||||
required String idPerumahan,
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return navigateTo<dynamic>(Routes.perumahanDetailView,
|
||||
arguments:
|
||||
PerumahanDetailViewArguments(key: key, idPerumahan: idPerumahan),
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToMandorTrackingIndexView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(Routes.mandorTrackingIndexView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToNestedUserHomeViewInUserIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(UserIndexViewRoutes.userHomeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToNestedUserProfileViewInUserIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(UserIndexViewRoutes.userProfileView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToNestedUserListPembangunanViewInUserIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(UserIndexViewRoutes.userListPembangunanView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedPengembangHomeViewInPengembangIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(PengembangIndexViewRoutes.pengembangHomeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedPengembangHome2ViewInPengembangIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(PengembangIndexViewRoutes.pengembangHome2View,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToNestedListPemilikViewInPengembangIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(PengembangIndexViewRoutes.listPemilikView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedPengembangProfilViewInPengembangIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(PengembangIndexViewRoutes.pengembangProfilView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedPengembangHomeViewInMandorTrackingIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(MandorTrackingIndexViewRoutes.pengembangHomeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedPengembangHome2ViewInMandorTrackingIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(
|
||||
MandorTrackingIndexViewRoutes.pengembangHome2View,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedListPemilikViewInMandorTrackingIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(MandorTrackingIndexViewRoutes.listPemilikView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
navigateToNestedPengembangProfilViewInMandorTrackingIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(
|
||||
MandorTrackingIndexViewRoutes.pengembangProfilView,
|
||||
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> replaceWithUserIndexView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(Routes.userIndexView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithPengembangIndexView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(Routes.pengembangIndexView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithPerumahanDetailView({
|
||||
_i8.Key? key,
|
||||
required String idPerumahan,
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return replaceWith<dynamic>(Routes.perumahanDetailView,
|
||||
arguments:
|
||||
PerumahanDetailViewArguments(key: key, idPerumahan: idPerumahan),
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithMandorTrackingIndexView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(Routes.mandorTrackingIndexView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithNestedUserHomeViewInUserIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(UserIndexViewRoutes.userHomeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithNestedUserProfileViewInUserIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(UserIndexViewRoutes.userProfileView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedUserListPembangunanViewInUserIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(UserIndexViewRoutes.userListPembangunanView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedPengembangHomeViewInPengembangIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(PengembangIndexViewRoutes.pengembangHomeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedPengembangHome2ViewInPengembangIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(PengembangIndexViewRoutes.pengembangHome2View,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithNestedListPemilikViewInPengembangIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(PengembangIndexViewRoutes.listPemilikView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedPengembangProfilViewInPengembangIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(PengembangIndexViewRoutes.pengembangProfilView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedPengembangHomeViewInMandorTrackingIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(
|
||||
MandorTrackingIndexViewRoutes.pengembangHomeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedPengembangHome2ViewInMandorTrackingIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(
|
||||
MandorTrackingIndexViewRoutes.pengembangHome2View,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedListPemilikViewInMandorTrackingIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(MandorTrackingIndexViewRoutes.listPemilikView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic>
|
||||
replaceWithNestedPengembangProfilViewInMandorTrackingIndexViewRouter([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(
|
||||
MandorTrackingIndexViewRoutes.pengembangProfilView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
}
|
||||
61
lib/app/core/custom_base_view_model.dart
Executable file
61
lib/app/core/custom_base_view_model.dart
Executable file
@ -0,0 +1,61 @@
|
||||
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>();
|
||||
final mySharedPrefs = locator<MySharedPrefs>();
|
||||
final easyLoading = locator<MyEasyLoading>();
|
||||
final httpService = locator<MyHttpServices>();
|
||||
final globalVar = locator<GlobalVar>();
|
||||
final myFunction = locator<MyFunction>();
|
||||
|
||||
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);
|
||||
43
lib/app/themes/app_text.dart
Normal file
43
lib/app/themes/app_text.dart
Normal file
@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:perumahan_bew/app/themes/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),
|
||||
);
|
||||
43
lib/main.dart
Normal file
43
lib/main.dart
Normal file
@ -0,0 +1,43 @@
|
||||
import 'dart:async';
|
||||
|
||||
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 {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
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: 'Perumahan Mutiara Alga',
|
||||
theme: appTheme,
|
||||
debugShowCheckedModeBanner: false,
|
||||
navigatorKey: StackedService.navigatorKey,
|
||||
onGenerateRoute: StackedRouter().onGenerateRoute,
|
||||
builder: EasyLoading.init(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setupAllLocator() async {
|
||||
await setupLocator();
|
||||
setupDialogUi();
|
||||
setupBottomSheetUi();
|
||||
// setupSnackbarUi();
|
||||
}
|
||||
62
lib/model/login_model.dart
Normal file
62
lib/model/login_model.dart
Normal file
@ -0,0 +1,62 @@
|
||||
class LoginDataModel {
|
||||
LoginDetailModel? value;
|
||||
String? level;
|
||||
|
||||
LoginDataModel({this.value, this.level});
|
||||
|
||||
LoginDataModel.fromJson(Map<String, dynamic> json) {
|
||||
value =
|
||||
json['value'] != null ? LoginDetailModel.fromJson(json['value']) : null;
|
||||
level = json['level'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (value != null) {
|
||||
data['value'] = value!.toJson();
|
||||
}
|
||||
data['level'] = level;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class LoginDetailModel {
|
||||
String? idLogin;
|
||||
String? username;
|
||||
String? password;
|
||||
String? idAdmin;
|
||||
String? idMandor;
|
||||
String? idRumah;
|
||||
String? level;
|
||||
|
||||
LoginDetailModel(
|
||||
{this.idLogin,
|
||||
this.username,
|
||||
this.password,
|
||||
this.idAdmin,
|
||||
this.idMandor,
|
||||
this.idRumah,
|
||||
this.level});
|
||||
|
||||
LoginDetailModel.fromJson(Map<String, dynamic> json) {
|
||||
idLogin = json['id_login'];
|
||||
username = json['username'];
|
||||
password = json['password'];
|
||||
idAdmin = json['id_admin'];
|
||||
idMandor = json['id_mandor'];
|
||||
idRumah = json['id_rumah'];
|
||||
level = json['level'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id_login'] = idLogin;
|
||||
data['username'] = username;
|
||||
data['password'] = password;
|
||||
data['id_admin'] = idAdmin;
|
||||
data['id_mandor'] = idMandor;
|
||||
data['id_rumah'] = idRumah;
|
||||
data['level'] = level;
|
||||
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 {
|
||||
bool? res;
|
||||
String? message;
|
||||
dynamic data;
|
||||
|
||||
MyResponseModel({this.res, this.message, this.data});
|
||||
|
||||
MyResponseModel.fromJson(Map<String, dynamic> json) {
|
||||
res = json['res'];
|
||||
message = json['message'];
|
||||
data = json['data'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['res'] = res;
|
||||
data['message'] = message;
|
||||
data['data'] = this.data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
124
lib/model/rumah_model.dart
Normal file
124
lib/model/rumah_model.dart
Normal file
@ -0,0 +1,124 @@
|
||||
import 'package:perumahan_bew/app/app.locator.dart';
|
||||
|
||||
import '../services/other_function.dart';
|
||||
|
||||
class RumahDetailModel {
|
||||
RumahModel? rumahModel;
|
||||
List<ProgressModel>? progressModel;
|
||||
|
||||
RumahDetailModel({this.rumahModel, this.progressModel});
|
||||
|
||||
RumahDetailModel.fromJson(Map<String, dynamic> json) {
|
||||
rumahModel =
|
||||
json['rumah'] != null ? RumahModel.fromJson(json['rumah']) : null;
|
||||
if (json['progress'] != null) {
|
||||
progressModel = <ProgressModel>[];
|
||||
json['progress'].forEach((v) {
|
||||
progressModel!.add(ProgressModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
if (rumahModel != null) {
|
||||
data['rumah'] = rumahModel!.toJson();
|
||||
}
|
||||
if (progressModel != null) {
|
||||
data['progress'] = progressModel!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class RumahModel {
|
||||
final myFunction = locator<MyFunction>();
|
||||
String? id;
|
||||
String? pemilik;
|
||||
String? tanggalPembelian;
|
||||
String? noTelpon;
|
||||
String? harga;
|
||||
String? cicilan;
|
||||
String? img;
|
||||
|
||||
RumahModel(
|
||||
{this.id,
|
||||
this.pemilik,
|
||||
this.tanggalPembelian,
|
||||
this.noTelpon,
|
||||
this.harga,
|
||||
this.cicilan,
|
||||
this.img});
|
||||
|
||||
RumahModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
pemilik = json['pemilik'];
|
||||
tanggalPembelian = myFunction.convertDateTime(json['tanggal_pembelian']);
|
||||
noTelpon = json['no_telpon'];
|
||||
harga = json['harga'];
|
||||
cicilan = json['cicilan'];
|
||||
img = json['img'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['pemilik'] = pemilik;
|
||||
data['tanggal_pembelian'] = tanggalPembelian;
|
||||
data['no_telpon'] = noTelpon;
|
||||
data['harga'] = harga;
|
||||
data['cicilan'] = cicilan;
|
||||
data['img'] = img;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ProgressModel {
|
||||
final myFunction = locator<MyFunction>();
|
||||
String? idProgress;
|
||||
String? ket;
|
||||
String? img;
|
||||
String? createdAt;
|
||||
String? idRumah;
|
||||
String? idMandor;
|
||||
String? nama;
|
||||
String? noTelpon;
|
||||
int? no;
|
||||
|
||||
ProgressModel(
|
||||
{this.idProgress,
|
||||
this.ket,
|
||||
this.img,
|
||||
this.createdAt,
|
||||
this.idRumah,
|
||||
this.idMandor,
|
||||
this.nama,
|
||||
this.noTelpon,
|
||||
this.no});
|
||||
|
||||
ProgressModel.fromJson(Map<String, dynamic> json) {
|
||||
idProgress = json['id_progress'];
|
||||
ket = json['ket'];
|
||||
img = json['img'];
|
||||
createdAt = myFunction.convertDateTime(json['created_at']);
|
||||
idRumah = json['id_rumah'];
|
||||
idMandor = json['id_mandor'];
|
||||
nama = json['nama'];
|
||||
noTelpon = json['no_telpon'];
|
||||
no = json['no'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id_progress'] = idProgress;
|
||||
data['ket'] = ket;
|
||||
data['img'] = img;
|
||||
data['created_at'] = createdAt;
|
||||
data['id_rumah'] = idRumah;
|
||||
data['id_mandor'] = idMandor;
|
||||
data['nama'] = nama;
|
||||
data['no_telpon'] = noTelpon;
|
||||
data['no'] = no;
|
||||
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';
|
||||
}
|
||||
56
lib/services/http_services.dart
Normal file
56
lib/services/http_services.dart
Normal file
@ -0,0 +1,56 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
dismiss() {
|
||||
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;
|
||||
}
|
||||
|
||||
String numberFormat(int input) {
|
||||
final formatter = NumberFormat('#,###');
|
||||
String formatted = formatter.format(input);
|
||||
return formatted;
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
133
lib/ui/views/login_screen/login_screen_view.dart
Normal file
133
lib/ui/views/login_screen/login_screen_view.dart
Normal file
@ -0,0 +1,133 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:perumahan_bew/ui/widgets/my_button.dart';
|
||||
import 'package:perumahan_bew/ui/widgets/my_textformfield.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:validatorless/validatorless.dart';
|
||||
|
||||
import '../../../app/themes/app_text.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(
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
// model.log.i('backPressed: ${model.globalVar.backPressed}');
|
||||
if (model.globalVar.backPressed == 'exitApp') {
|
||||
// model.back();
|
||||
model.quitApp(context);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Form(
|
||||
key: model.formKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.15,
|
||||
),
|
||||
Text(
|
||||
"Perumahan Mutiara Alga",
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 21,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/house.svg',
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Login Ke Akun Anda',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: MyTextFormField(
|
||||
hintText: "Masukkan Username",
|
||||
labelText: "Username",
|
||||
validator: Validatorless.required(
|
||||
'Username tidak boleh kosong'),
|
||||
controller: model.usernameController,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: MyTextFormField(
|
||||
hintText: "Masukkan Password",
|
||||
labelText: "Password",
|
||||
obscureText: !model.isPasswordVisible,
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
model.isPasswordVisible =
|
||||
!model.isPasswordVisible;
|
||||
model.notifyListeners();
|
||||
},
|
||||
icon: Icon(
|
||||
model.isPasswordVisible
|
||||
? Icons.visibility
|
||||
: Icons.visibility_off,
|
||||
),
|
||||
),
|
||||
validator: Validatorless.required(
|
||||
'Password tidak boleh kosong'),
|
||||
controller: model.passwordController,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.4,
|
||||
child: MyButton(
|
||||
text: "LOGIN",
|
||||
onPressed: () {
|
||||
if (model.formKey.currentState!.validate()) {
|
||||
model.login();
|
||||
}
|
||||
// model.login();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
70
lib/ui/views/login_screen/login_screen_view_model.dart
Normal file
70
lib/ui/views/login_screen/login_screen_view_model.dart
Normal file
@ -0,0 +1,70 @@
|
||||
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/login_model.dart';
|
||||
import '../../../model/my_response_model.dart';
|
||||
|
||||
class LoginScreenViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('LoginScreenViewModel');
|
||||
|
||||
// form variables
|
||||
final formKey = GlobalKey<FormState>();
|
||||
TextEditingController usernameController = TextEditingController();
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
bool isPasswordVisible = false;
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = "exitApp";
|
||||
}
|
||||
|
||||
login() async {
|
||||
log.i('login');
|
||||
setBusy(true);
|
||||
globalVar.backPressed = "cantBack";
|
||||
easyLoading.customLoading('Login...');
|
||||
try {
|
||||
String username = usernameController.text;
|
||||
String password = passwordController.text;
|
||||
var response =
|
||||
await httpService.get('login?username=$username&password=$password');
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
log.i('myResponseModel: ${myResponseModel.data}');
|
||||
LoginDataModel loginDataModel =
|
||||
LoginDataModel.fromJson(myResponseModel.data);
|
||||
LoginDetailModel loginDetailModel = loginDataModel.value!;
|
||||
String level = loginDataModel.level!;
|
||||
log.i('level: $level');
|
||||
|
||||
await mySharedPrefs.setString('level', level);
|
||||
await mySharedPrefs.setString(
|
||||
'id',
|
||||
level == 'Admin'
|
||||
? "Admin"
|
||||
: (level == 'Mandor'
|
||||
? loginDetailModel.idMandor!
|
||||
: loginDetailModel.idRumah!));
|
||||
easyLoading.dismiss();
|
||||
snackbarService.showSnackbar(
|
||||
title: 'Login berhasil',
|
||||
message: 'Selamat datang kembali',
|
||||
duration: const Duration(seconds: 3),
|
||||
);
|
||||
|
||||
if (level == 'Admin') {
|
||||
navigationService.navigateToPengembangIndexView();
|
||||
} else if (level == 'Mandor') {
|
||||
navigationService.navigateToMandorTrackingIndexView();
|
||||
} else {
|
||||
navigationService.navigateToUserIndexView();
|
||||
}
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
} finally {
|
||||
setBusy(false);
|
||||
globalVar.backPressed = "exitApp";
|
||||
easyLoading.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:perumahan_bew/app/app.router.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/themes/app_colors.dart';
|
||||
import '../../../app/themes/app_text.dart';
|
||||
import './mandor_tracking_index_view_model.dart';
|
||||
|
||||
class MandorTrackingIndexView extends StatelessWidget {
|
||||
const MandorTrackingIndexView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<MandorTrackingIndexViewModel>.reactive(
|
||||
viewModelBuilder: () => MandorTrackingIndexViewModel(),
|
||||
onViewModelReady: (MandorTrackingIndexViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
MandorTrackingIndexViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
model.header,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
backgroundColor: mainColor,
|
||||
elevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
body: ExtendedNavigator(
|
||||
navigatorKey: StackedService.nestedNavigationKey(4),
|
||||
router: MandorTrackingIndexViewRouter(),
|
||||
),
|
||||
bottomNavigationBar: StylishBottomBar(
|
||||
items: [
|
||||
for (var item in model.bottomNavBarList)
|
||||
BottomBarItem(
|
||||
icon: Icon(item['icon'],
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? mainColor
|
||||
: backgroundColor),
|
||||
title: Text(
|
||||
item['name'],
|
||||
style: regularTextStyle.copyWith(
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? mainColor
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
backgroundColor:
|
||||
model.currentIndex == model.bottomNavBarList.indexOf(item)
|
||||
? Colors.white
|
||||
: Colors.grey,
|
||||
),
|
||||
],
|
||||
currentIndex: model.currentIndex,
|
||||
option: BubbleBarOptions(),
|
||||
hasNotch: true,
|
||||
backgroundColor: mainColor,
|
||||
onTap: (value) {
|
||||
model.handleNavigation(value);
|
||||
},
|
||||
// fabLocation: StylishBarFabLocation.center,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
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';
|
||||
|
||||
class MandorTrackingIndexViewModel extends IndexTrackingViewModel {
|
||||
final log = getLogger('MandorTrackingIndexViewModel');
|
||||
final _navigationService = locator<NavigationService>();
|
||||
|
||||
final _bottomNavBarList = [
|
||||
{'name': 'List', 'icon': Icons.list_alt_rounded, 'header': 'List Pemilik'},
|
||||
{'name': 'Denah', 'icon': Icons.home_outlined, 'header': 'Denah Perumahan'},
|
||||
{'name': 'Profil', 'icon': Icons.person_outline, 'header': 'Profil Mandor'},
|
||||
];
|
||||
|
||||
List<Map<String, dynamic>> get bottomNavBarList => _bottomNavBarList;
|
||||
|
||||
final List<String> _views = [
|
||||
MandorTrackingIndexViewRoutes.listPemilikView,
|
||||
MandorTrackingIndexViewRoutes.pengembangHome2View,
|
||||
MandorTrackingIndexViewRoutes.pengembangProfilView,
|
||||
];
|
||||
|
||||
String header = 'Denah Perumahan';
|
||||
|
||||
Future<void> init() async {
|
||||
setIndex(1);
|
||||
}
|
||||
|
||||
void handleNavigation(int index) {
|
||||
log.d("handleNavigation: $index");
|
||||
log.d("currentIndex: ${_views[index]}");
|
||||
|
||||
if (currentIndex == index) return;
|
||||
|
||||
setIndex(index);
|
||||
header = _bottomNavBarList[index]['header'] as String;
|
||||
_navigationService.navigateTo(
|
||||
_views[index],
|
||||
id: 4,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,135 @@
|
||||
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 './list_pemilik_view_model.dart';
|
||||
|
||||
class ListPemilikView extends StatelessWidget {
|
||||
const ListPemilikView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<ListPemilikViewModel>.reactive(
|
||||
viewModelBuilder: () => ListPemilikViewModel(),
|
||||
onViewModelReady: (ListPemilikViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
ListPemilikViewModel 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: Column(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MyTopWidget(
|
||||
icon: Icons.person_outline,
|
||||
title: 'Jumlah Pemilik',
|
||||
subtitle: model.isBusy
|
||||
? 'Loading...'
|
||||
: model.status
|
||||
? '${model.counterPemilik} Pemilik'
|
||||
: 'Error Loading Data',
|
||||
// lastUpdate: '31/02/15 - 10.00 am',
|
||||
),
|
||||
MyTopWidget(
|
||||
icon: Icons.home,
|
||||
subtitle: model.isBusy
|
||||
? 'Loading...'
|
||||
: model.status
|
||||
? '${model.counterPembangunan} kali'
|
||||
: 'Error Loading Data',
|
||||
title: 'Pembangunan',
|
||||
// lastUpdate: '31/02/15 - 10.00 am',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
spreadRadius: 5,
|
||||
blurRadius: 7,
|
||||
// offset: Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
// create a listview with 20 dummy data on card and scrollable
|
||||
child: model.isBusy
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: model.status
|
||||
? (model.counterPembangunan > 0
|
||||
? ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 10),
|
||||
itemCount: model.listProgress.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Card(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
model.log.i('Card $index tapped');
|
||||
},
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
model.listProgress[index]
|
||||
.createdAt ??
|
||||
'',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
color: mainColor)),
|
||||
//
|
||||
subtitle: Text(model
|
||||
.listProgress[index]
|
||||
.ket ??
|
||||
''),
|
||||
trailing: Text(
|
||||
'Rumah ${model.listProgress[index].idRumah!.toUpperCase()}'),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: const Center(
|
||||
child:
|
||||
Text('Tidak ada data Pembangunana'),
|
||||
))
|
||||
: const Center(
|
||||
child: Text('Error Loading Data'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../model/my_response_model.dart';
|
||||
import '../../../../model/rumah_model.dart';
|
||||
|
||||
class ListPemilikViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('ListPemilikViewModel');
|
||||
int counterPemilik = 0;
|
||||
int counterPembangunan = 0;
|
||||
List<ProgressModel> listProgress = [];
|
||||
|
||||
bool status = false;
|
||||
String? level;
|
||||
String? id;
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = "exitApp";
|
||||
level = await mySharedPrefs.getString('level') ?? '';
|
||||
id = await mySharedPrefs.getString('id') ?? '';
|
||||
// log.i('level: $level');
|
||||
await getData();
|
||||
}
|
||||
|
||||
getData() async {
|
||||
setBusy(true);
|
||||
try {
|
||||
var response = await httpService.get('pemilik');
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
counterPemilik = myResponseModel.data.length;
|
||||
|
||||
response = await httpService.get(
|
||||
'pembangunan?stat=${level == 'Mandor' ? 'mandor&id_mandor=$id' : 'all'}');
|
||||
myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
counterPembangunan = myResponseModel.data.length;
|
||||
// log.i('myResponseModel: ${myResponseModel.data}');
|
||||
|
||||
for (var item in myResponseModel.data) {
|
||||
ProgressModel progressModel = ProgressModel.fromJson(item);
|
||||
listProgress.add(progressModel);
|
||||
}
|
||||
// reverse the list
|
||||
listProgress = listProgress.reversed.toList();
|
||||
|
||||
status = true;
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
status = false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../pengembang_home_view.dart';
|
||||
import './pengembang_home2_view_model.dart';
|
||||
|
||||
class PengembangHome2View extends StatelessWidget {
|
||||
const PengembangHome2View({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PengembangHome2ViewModel>.reactive(
|
||||
viewModelBuilder: () => PengembangHome2ViewModel(),
|
||||
onViewModelReady: (PengembangHome2ViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
PengembangHome2ViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return const PengembangHomeView();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
import '../../../../../app/core/custom_base_view_model.dart';
|
||||
|
||||
class PengembangHome2ViewModel extends CustomBaseViewModel {
|
||||
Future<void> init() async {}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import './pengembang_home_view_model.dart';
|
||||
|
||||
class PengembangHomeView extends StatelessWidget {
|
||||
const PengembangHomeView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PengembangHomeViewModel>.reactive(
|
||||
viewModelBuilder: () => PengembangHomeViewModel(),
|
||||
onViewModelReady: (PengembangHomeViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
disposeViewModel: false,
|
||||
fireOnViewModelReadyOnce: true,
|
||||
builder: (
|
||||
BuildContext context,
|
||||
PengembangHomeViewModel 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: WebView(
|
||||
// initialUrl: 'http://192.168.43.125/rekam-medis',
|
||||
initialUrl: model.url,
|
||||
javascriptMode: JavascriptMode.unrestricted,
|
||||
onWebViewCreated: (WebViewController webViewController) {
|
||||
// _controller.complete(webViewController);
|
||||
model.webViewControllerCompleter.future
|
||||
.then((value) => model.webVIewcontroller = value);
|
||||
model.webViewControllerCompleter.complete(webViewController);
|
||||
},
|
||||
onProgress: (int progress) {
|
||||
double progressDouble = progress / 100;
|
||||
LinearProgressIndicator(
|
||||
value: progressDouble,
|
||||
);
|
||||
// model.myEasyLoading.showProgress(progressDouble, "Loading Denah");
|
||||
},
|
||||
// javascriptChannels: <JavascriptChannel>{
|
||||
// _toasterJavascriptChannel(context),
|
||||
// },
|
||||
javascriptChannels: <JavascriptChannel>{
|
||||
JavascriptChannel(
|
||||
name: 'messageHandler',
|
||||
onMessageReceived: (JavascriptMessage message) {
|
||||
model.log.d(message.message);
|
||||
// var data = JsonDecoder().convert(message.message);
|
||||
// model.log.d(data['status']);
|
||||
model.goToDetail(message.message);
|
||||
|
||||
// dev.i("message from the web view=\"${message.message}\"");
|
||||
// if (message.message == "coba") {
|
||||
// dev.i("sini untuk coba");
|
||||
// controller.runJavascript("coba22('heheheh')");
|
||||
// }
|
||||
},
|
||||
),
|
||||
},
|
||||
// navigationDelegate: (NavigationRequest request) async {},
|
||||
onPageStarted: (String url) {},
|
||||
onPageFinished: (String url) {
|
||||
// dev.i('Page finished loading: $url');
|
||||
model.easyLoading.dismiss();
|
||||
},
|
||||
|
||||
gestureNavigationEnabled: true,
|
||||
backgroundColor: const Color(0x00000000),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import '../../../../app/app.bottomsheets.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/app.router.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../model/my_response_model.dart';
|
||||
|
||||
class PengembangHomeViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('PengembangHomeViewModel');
|
||||
|
||||
late String url;
|
||||
late String level;
|
||||
|
||||
late WebViewController webVIewcontroller;
|
||||
final Completer<WebViewController> webViewControllerCompleter =
|
||||
Completer<WebViewController>();
|
||||
|
||||
Future<void> init() async {
|
||||
globalVar.backPressed = "exitApp";
|
||||
url = dotenv.env['url']!;
|
||||
log.d(url);
|
||||
if (Platform.isAndroid) {
|
||||
WebView.platform = SurfaceAndroidWebView();
|
||||
}
|
||||
level = await mySharedPrefs.getString('level') ?? '';
|
||||
log.d('level: $level');
|
||||
if (level == '') {
|
||||
navigationService.clearTillFirstAndShow(Routes.loginScreenView);
|
||||
}
|
||||
}
|
||||
|
||||
goToDetail(String message) async {
|
||||
setBusy(true);
|
||||
easyLoading.customLoading('Loading...');
|
||||
try {
|
||||
var response = await httpService.get('cek_rumah?id=$message');
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
log.i('myResponseModel: ${myResponseModel.res}');
|
||||
if (myResponseModel.res == true) {
|
||||
navigationService.navigateTo(
|
||||
'/perumahan-detail-view',
|
||||
arguments: PerumahanDetailViewArguments(idPerumahan: message),
|
||||
);
|
||||
} else {
|
||||
// easyLoading.showError('Data tidak ditemukan');
|
||||
easyLoading.dismiss();
|
||||
if (level == 'Mandor') {
|
||||
snackbarService.showSnackbar(
|
||||
message: 'Data Rumah Belum Ada',
|
||||
title: 'Gagal',
|
||||
duration: const Duration(seconds: 2),
|
||||
);
|
||||
return;
|
||||
}
|
||||
var res = await bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.tambahRumahBottomSheetView,
|
||||
title: 'Form Tambah Pemilik Rumah',
|
||||
data: message,
|
||||
);
|
||||
// res;
|
||||
|
||||
if (res!.confirmed) {
|
||||
webVIewcontroller.reload();
|
||||
snackbarService.showSnackbar(
|
||||
message:
|
||||
'Pemilik Rumah ${res.data.toString().toUpperCase()} berhasil ditambahkan',
|
||||
title: 'Berhasil',
|
||||
duration: const Duration(seconds: 2),
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
} finally {
|
||||
setBusy(false);
|
||||
easyLoading.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,242 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:omni_datetime_picker/omni_datetime_picker.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_button.dart';
|
||||
import '../../../../widgets/my_textformfield.dart';
|
||||
import './tambah_rumah_bottom_sheet_view_model.dart';
|
||||
|
||||
class TambahRumahBottomSheetView extends StatelessWidget {
|
||||
final SheetRequest? request;
|
||||
final Function(SheetResponse)? completer;
|
||||
|
||||
const TambahRumahBottomSheetView({Key? key, this.request, this.completer})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<TambahRumahBottomSheetViewModel>.reactive(
|
||||
viewModelBuilder: () => TambahRumahBottomSheetViewModel(),
|
||||
onViewModelReady: (TambahRumahBottomSheetViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
TambahRumahBottomSheetViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: const BoxDecoration(
|
||||
color: backgroundColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(
|
||||
20,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Form(
|
||||
key: model.globalKey,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'${request!.title!} ${request!.data.toString().toUpperCase()}',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyTextFormField(
|
||||
labelText: 'Nama Pemilik Rumah',
|
||||
hintText: 'Masukkan Nama Pemilik Rumah',
|
||||
suffixIcon: const Icon(
|
||||
Icons.person,
|
||||
color: mainColor,
|
||||
),
|
||||
validator: Validatorless.required(
|
||||
'Nama Pemilik Rumah Tidak Boleh Kosong'),
|
||||
controller: model.namaPemilikRumahController,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyTextFormField(
|
||||
labelText: 'No. Telp',
|
||||
hintText: 'Masukkan No. Telp',
|
||||
suffixIcon: const Icon(
|
||||
Icons.phone,
|
||||
color: mainColor,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: Validatorless.multiple(
|
||||
[
|
||||
Validatorless.required('No. Telp Tidak Boleh Kosong'),
|
||||
Validatorless.number('No. Telp Harus Angka'),
|
||||
Validatorless.min(9, 'No. Telp Minimal 10 Angka'),
|
||||
Validatorless.max(13, 'No. Telp Maksimal 13 Angka'),
|
||||
],
|
||||
),
|
||||
controller: model.noHpPemilikRumahController,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyTextFormField(
|
||||
labelText: 'Harga Rumah',
|
||||
hintText: 'Masukkan Harga Rumah',
|
||||
keyboardType: TextInputType.number,
|
||||
suffixIcon: const Icon(
|
||||
Icons.attach_money,
|
||||
color: mainColor,
|
||||
),
|
||||
validator: Validatorless.multiple(
|
||||
[
|
||||
Validatorless.required(
|
||||
'Harga Rumah Tidak Boleh Kosong'),
|
||||
Validatorless.number('Harga Rumah Harus Angka'),
|
||||
],
|
||||
),
|
||||
controller: model.hargaRumahController,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyTextFormField(
|
||||
labelText: 'Cicilan / Bulan',
|
||||
hintText: 'Masukkan Cicilan / Bulan',
|
||||
keyboardType: TextInputType.number,
|
||||
suffixIcon: const Icon(
|
||||
Icons.attach_money,
|
||||
color: mainColor,
|
||||
),
|
||||
validator: Validatorless.multiple(
|
||||
[
|
||||
Validatorless.required(
|
||||
'Cicilan / Bulan Tidak Boleh Kosong'),
|
||||
Validatorless.number('Cicilan / Bulan Harus Angka'),
|
||||
],
|
||||
),
|
||||
controller: model.bayarPerbulanController,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
MyTextFormField(
|
||||
hintText: "Tanggal Pembelian",
|
||||
labelText: "Tanggal Pembelian",
|
||||
suffixIcon: const Icon(
|
||||
Icons.date_range,
|
||||
color: mainColor,
|
||||
),
|
||||
readOnly: true,
|
||||
controller: model.tglBeliController,
|
||||
onTap: () async {
|
||||
DateTime? dateTime = await showOmniDateTimePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(1600)
|
||||
.subtract(const Duration(days: 3652)),
|
||||
lastDate: DateTime.now().add(
|
||||
const Duration(days: 3652),
|
||||
),
|
||||
is24HourMode: false,
|
||||
isShowSeconds: false,
|
||||
minutesInterval: 1,
|
||||
secondsInterval: 1,
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(16)),
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 350,
|
||||
maxHeight: 650,
|
||||
),
|
||||
transitionBuilder: (context, anim1, anim2, child) {
|
||||
return FadeTransition(
|
||||
opacity: anim1.drive(
|
||||
Tween(
|
||||
begin: 0,
|
||||
end: 1,
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
transitionDuration: const Duration(milliseconds: 200),
|
||||
barrierDismissible: true,
|
||||
selectableDayPredicate: (dateTime) {
|
||||
// Disable 25th Feb 2023
|
||||
if (dateTime == DateTime(2023, 2, 25)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
);
|
||||
model.log.i(dateTime);
|
||||
if (dateTime != null) {
|
||||
model.tglBeliController.text = model.myFunction
|
||||
.convertDateTime(dateTime.toString());
|
||||
model.dateTime = dateTime.toString();
|
||||
}
|
||||
model.notifyListeners();
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: 250,
|
||||
child: MyButton(
|
||||
text: 'Tambah',
|
||||
onPressed: () {
|
||||
if (model.globalKey.currentState!.validate()) {
|
||||
model.dialogService
|
||||
.showDialog(
|
||||
title: 'Tambah Pemilik Rumah',
|
||||
description:
|
||||
'Apakah anda yakin ingin menambahkan pemilik rumah ${request!.data.toString().toUpperCase()} ini?',
|
||||
buttonTitle: 'Ya',
|
||||
cancelTitle: 'Tidak',
|
||||
)
|
||||
.then((value) async {
|
||||
if (value!.confirmed) {
|
||||
// model.log.i(request!.data);
|
||||
bool res = await model
|
||||
.tambahRumah(request!.data.toString());
|
||||
model.log.i('res: $res');
|
||||
if (res == true) {
|
||||
completer!(SheetResponse(
|
||||
confirmed: true,
|
||||
data: request!.data,
|
||||
));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../app/app.logger.dart';
|
||||
import '../../../../../app/core/custom_base_view_model.dart';
|
||||
|
||||
class TambahRumahBottomSheetViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('TambahRumahBottomSheetViewModel');
|
||||
|
||||
// form variables
|
||||
final globalKey = GlobalKey<FormState>();
|
||||
TextEditingController namaPemilikRumahController = TextEditingController();
|
||||
TextEditingController noHpPemilikRumahController = TextEditingController();
|
||||
TextEditingController hargaRumahController = TextEditingController();
|
||||
TextEditingController bayarPerbulanController = TextEditingController();
|
||||
TextEditingController tglBeliController = TextEditingController();
|
||||
String? dateTime;
|
||||
|
||||
Future<void> init() async {}
|
||||
|
||||
Future<bool> tambahRumah(String idPerumahan) async {
|
||||
setBusy(true);
|
||||
easyLoading.customLoading('Tambah Pemilik Rumah...');
|
||||
try {
|
||||
String harga =
|
||||
myFunction.numberFormat(int.parse(hargaRumahController.text));
|
||||
String cicilan =
|
||||
myFunction.numberFormat(int.parse(bayarPerbulanController.text));
|
||||
// log.i(myFunction.numberFormat(int.parse(hargaRumahController.text)));
|
||||
var formData = FormData.fromMap({
|
||||
'id_rumah': idPerumahan,
|
||||
'nama': namaPemilikRumahController.text,
|
||||
'no_hp': noHpPemilikRumahController.text,
|
||||
'harga': harga,
|
||||
'cicilan': cicilan,
|
||||
'tanggal_pembelian': dateTime,
|
||||
});
|
||||
// log.i(hargaRumahController.text);
|
||||
// log.i(bayarPerbulanController.text);
|
||||
await httpService.postWithFormData(
|
||||
'rumahnya',
|
||||
formData,
|
||||
);
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
return false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
easyLoading.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
83
lib/ui/views/pengembang_index/pengembang_index_view.dart
Normal file
83
lib/ui/views/pengembang_index/pengembang_index_view.dart
Normal file
@ -0,0 +1,83 @@
|
||||
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 './pengembang_index_view_model.dart';
|
||||
|
||||
class PengembangIndexView extends StatelessWidget {
|
||||
const PengembangIndexView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PengembangIndexViewModel>.reactive(
|
||||
viewModelBuilder: () => PengembangIndexViewModel(),
|
||||
onViewModelReady: (PengembangIndexViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
disposeViewModel: false,
|
||||
fireOnViewModelReadyOnce: true,
|
||||
builder: (
|
||||
BuildContext context,
|
||||
PengembangIndexViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
model.header,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
backgroundColor: mainColor,
|
||||
elevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
body: ExtendedNavigator(
|
||||
navigatorKey: StackedService.nestedNavigationKey(3),
|
||||
router: PengembangIndexViewRouter(),
|
||||
),
|
||||
bottomNavigationBar: StylishBottomBar(
|
||||
items: [
|
||||
for (var item in model.bottomNavBarList)
|
||||
BottomBarItem(
|
||||
icon: Icon(item['icon'],
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? mainColor
|
||||
: backgroundColor),
|
||||
title: Text(
|
||||
item['name'],
|
||||
style: regularTextStyle.copyWith(
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? mainColor
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
backgroundColor:
|
||||
model.currentIndex == model.bottomNavBarList.indexOf(item)
|
||||
? Colors.white
|
||||
: Colors.grey,
|
||||
),
|
||||
],
|
||||
currentIndex: model.currentIndex,
|
||||
option: BubbleBarOptions(),
|
||||
hasNotch: true,
|
||||
backgroundColor: mainColor,
|
||||
onTap: (value) {
|
||||
model.handleNavigation(value);
|
||||
},
|
||||
// fabLocation: StylishBarFabLocation.center,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
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';
|
||||
|
||||
class PengembangIndexViewModel extends IndexTrackingViewModel {
|
||||
final log = getLogger('PengembangIndexViewModel');
|
||||
final _navigationService = locator<NavigationService>();
|
||||
|
||||
final _bottomNavBarList = [
|
||||
{'name': 'List', 'icon': Icons.list_alt_rounded, 'header': 'List Pemilik'},
|
||||
{'name': 'Denah', 'icon': Icons.home_outlined, 'header': 'Denah Perumahan'},
|
||||
{'name': 'Profil', 'icon': Icons.person_outline, 'header': 'Profil Mandor'},
|
||||
];
|
||||
|
||||
List<Map<String, dynamic>> get bottomNavBarList => _bottomNavBarList;
|
||||
|
||||
final List<String> _views = [
|
||||
PengembangIndexViewRoutes.listPemilikView,
|
||||
PengembangIndexViewRoutes.pengembangHome2View,
|
||||
PengembangIndexViewRoutes.pengembangProfilView,
|
||||
];
|
||||
|
||||
String header = 'Denah Perumahan';
|
||||
|
||||
Future<void> init() async {
|
||||
setIndex(1);
|
||||
}
|
||||
|
||||
void handleNavigation(int index) {
|
||||
log.d("handleNavigation: $index");
|
||||
log.d("currentIndex: ${_views[index]}");
|
||||
|
||||
if (currentIndex == index) return;
|
||||
|
||||
setIndex(index);
|
||||
header = _bottomNavBarList[index]['header'] as String;
|
||||
_navigationService.navigateTo(
|
||||
_views[index],
|
||||
id: 3,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import './pengembang_profil_view_model.dart';
|
||||
|
||||
class PengembangProfilView extends StatelessWidget {
|
||||
const PengembangProfilView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PengembangProfilViewModel>.reactive(
|
||||
viewModelBuilder: () => PengembangProfilViewModel(),
|
||||
onViewModelReady: (PengembangProfilViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
PengembangProfilViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: Text(
|
||||
'PengembangProfilView',
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
import 'package:perumahan_bew/app/core/custom_base_view_model.dart';
|
||||
|
||||
class PengembangProfilViewModel extends CustomBaseViewModel {
|
||||
Future<void> init() async {}
|
||||
}
|
||||
@ -0,0 +1,293 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../../../../app/themes/app_colors.dart';
|
||||
import '../../../../app/themes/app_text.dart';
|
||||
import './perumahan_detail_view_model.dart';
|
||||
|
||||
class PerumahanDetailView extends StatelessWidget {
|
||||
const PerumahanDetailView({super.key, required this.idPerumahan});
|
||||
|
||||
final String idPerumahan;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PerumahanDetailViewModel>.reactive(
|
||||
viewModelBuilder: () => PerumahanDetailViewModel(),
|
||||
onViewModelReady: (PerumahanDetailViewModel model) async {
|
||||
await model.init(idPerumahan);
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
PerumahanDetailViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'Perumahan Blok ${model.blok} , No. ${model.idRumah}',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
backgroundColor: mainColor,
|
||||
elevation: 0,
|
||||
),
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (model.globalVar.backPressed == 'exitApp') {
|
||||
// model.back();
|
||||
return true;
|
||||
// model.quitApp(context);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 7,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: model.isBusy
|
||||
? const Padding(
|
||||
padding: EdgeInsets.all(30),
|
||||
child: CircularProgressIndicator(
|
||||
color: mainColor,
|
||||
),
|
||||
)
|
||||
: model.status
|
||||
? (model.rumahModel!.img == null
|
||||
? const Icon(
|
||||
Icons.person,
|
||||
color: mainColor,
|
||||
size: 50,
|
||||
)
|
||||
: Image.network(
|
||||
model.rumahModel!.img!,
|
||||
fit: BoxFit.cover,
|
||||
))
|
||||
: const Icon(
|
||||
Icons.error,
|
||||
color: dangerColor,
|
||||
size: 50,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
model.isBusy
|
||||
? 'Loading...'
|
||||
: model.status
|
||||
? model.rumahModel!.pemilik!
|
||||
: 'Error Loading Data',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
_FirstDetail(
|
||||
text: model.isBusy
|
||||
? 'Loading...'
|
||||
: model.status
|
||||
? model.rumahModel!.tanggalPembelian!
|
||||
: 'Error Loading Data',
|
||||
icon: Icons.calendar_today_outlined,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
_FirstDetail(
|
||||
text: model.isBusy
|
||||
? 'Loading...'
|
||||
: model.status
|
||||
? 'Rp. ${model.rumahModel!.harga!}'
|
||||
: 'Error Loading Data',
|
||||
icon: Icons.attach_money_outlined,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
_FirstDetail(
|
||||
text: model.isBusy
|
||||
? 'Loading...'
|
||||
: model.status
|
||||
? 'Rp. ${model.rumahModel!.cicilan!} / bulan'
|
||||
: 'Error Loading Data',
|
||||
icon: Icons.money_outlined,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
_FirstDetail(
|
||||
text: model.isBusy
|
||||
? 'Loading...'
|
||||
: model.status
|
||||
? model.rumahModel!.noTelpon!
|
||||
: 'Error Loading Data',
|
||||
icon: Icons.phone_outlined,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
spreadRadius: 5,
|
||||
blurRadius: 7,
|
||||
// offset: Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
// create a listview with 20 dummy data on card and scrollable
|
||||
child: model.isBusy
|
||||
? const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: mainColor,
|
||||
),
|
||||
)
|
||||
: model.progressModel!.isEmpty
|
||||
? const Center(
|
||||
child: Text(
|
||||
'Data Kosong, Belum Ada Progress'),
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 10),
|
||||
itemCount: model.progressModel!.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Card(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
model.log.i('Card $index tapped');
|
||||
},
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
model.progressModel![index]
|
||||
.createdAt!,
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
color: mainColor)),
|
||||
subtitle: Text(model
|
||||
.progressModel![index].ket!),
|
||||
trailing: Text(
|
||||
'Pembangunan ${model.progressModel![index].no!}'),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (model.level == 'Mandor')
|
||||
Positioned(
|
||||
top: 15,
|
||||
right: 15,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: mainColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 7,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
model.ambilGambarVideo();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.camera_alt_outlined,
|
||||
color: Colors.white,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _FirstDetail extends StatelessWidget {
|
||||
const _FirstDetail({
|
||||
Key? key,
|
||||
required this.text,
|
||||
required this.icon,
|
||||
}) : super(key: key);
|
||||
|
||||
final String text;
|
||||
final IconData icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
color: mainColor,
|
||||
size: 40,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Text(
|
||||
text,
|
||||
style: regularTextStyle.copyWith(
|
||||
fontSize: 15,
|
||||
color: mainGrey,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
import '../../../../app/app.bottomsheets.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/app.router.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../model/my_response_model.dart';
|
||||
import '../../../../model/rumah_model.dart';
|
||||
|
||||
class PerumahanDetailViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('PerumahanDetailViewModel');
|
||||
late String idPerumahan;
|
||||
late String blok;
|
||||
late String idRumah;
|
||||
late String level;
|
||||
|
||||
bool status = false;
|
||||
|
||||
RumahModel? rumahModel;
|
||||
List<ProgressModel>? progressModel;
|
||||
|
||||
Future<void> init(String idPerumahan) async {
|
||||
level = await mySharedPrefs.getString('level') ?? '';
|
||||
if (level == '') {
|
||||
navigationService.clearTillFirstAndShow(Routes.loginScreenView);
|
||||
}
|
||||
this.idPerumahan = idPerumahan;
|
||||
// globalVar.backPressed = "backNormal";
|
||||
// setBusy(true);
|
||||
// seperate the number from the string
|
||||
blok = idPerumahan.replaceAll(RegExp(r'[0-9]'), '');
|
||||
// change the blok to uppercase
|
||||
blok = blok.toUpperCase();
|
||||
// log.i('blok: $blok');
|
||||
idRumah = idPerumahan.replaceAll(RegExp(r'[^0-9]'), '');
|
||||
// log.i('idRumah: $idRumah');
|
||||
await getData();
|
||||
// setBusy(false);
|
||||
}
|
||||
|
||||
getData() async {
|
||||
setBusy(true);
|
||||
|
||||
try {
|
||||
var respose = await httpService.get('rumah?id=$idPerumahan');
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(respose.data);
|
||||
RumahDetailModel rumahDetailModel =
|
||||
RumahDetailModel.fromJson(myResponseModel.data);
|
||||
rumahModel = rumahDetailModel.rumahModel!;
|
||||
progressModel = rumahDetailModel.progressModel!;
|
||||
log.i('rumahModel: ${rumahModel!.img}');
|
||||
status = true;
|
||||
} catch (e) {
|
||||
log.e('Error: $e');
|
||||
status = false;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
ambilGambarVideo() async {
|
||||
var res = await bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.tambahLihatProgressBottomSheetView,
|
||||
title: 'Form Tambah Progress',
|
||||
data: idPerumahan,
|
||||
);
|
||||
|
||||
if (res!.confirmed) {
|
||||
snackbarService.showSnackbar(
|
||||
message: 'Berhasil menambah progress',
|
||||
title: 'Berhasil',
|
||||
duration: const Duration(seconds: 2),
|
||||
);
|
||||
await getData();
|
||||
}
|
||||
}
|
||||
}
|
||||
86
lib/ui/views/play_video_dialog/play_video_dialog_view.dart
Normal file
86
lib/ui/views/play_video_dialog/play_video_dialog_view.dart
Normal file
@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:native_video_player/native_video_player.dart';
|
||||
import 'package:perumahan_bew/ui/widgets/my_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import './play_video_dialog_view_model.dart';
|
||||
|
||||
class PlayVideoDialogView extends StatelessWidget {
|
||||
final DialogRequest? request;
|
||||
final Function(DialogResponse)? completer;
|
||||
|
||||
const PlayVideoDialogView({
|
||||
Key? key,
|
||||
this.request,
|
||||
this.completer,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<PlayVideoDialogViewModel>.reactive(
|
||||
viewModelBuilder: () => PlayVideoDialogViewModel(),
|
||||
onViewModelReady: (PlayVideoDialogViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
PlayVideoDialogViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Dialog(
|
||||
child: Container(
|
||||
// width: MediaQuery.of(context).size.width * 0.8,
|
||||
// height: 450,
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 16 / 11,
|
||||
child: NativeVideoPlayerView(
|
||||
onViewReady: (controller) async {
|
||||
final videoSource = await VideoSource.init(
|
||||
path: request!.data.toString(),
|
||||
type: VideoSourceType.file,
|
||||
);
|
||||
await controller.loadVideoSource(videoSource);
|
||||
model.nativeVideoPlayerController = controller;
|
||||
model.notifyListeners();
|
||||
model.nativeVideoPlayerController!.play();
|
||||
// loop video
|
||||
model.nativeVideoPlayerController!.onPlaybackEnded
|
||||
.addListener(() {
|
||||
model.nativeVideoPlayerController!.seekTo(0);
|
||||
model.nativeVideoPlayerController!.play();
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
// create button to play video
|
||||
SizedBox(
|
||||
width: 150,
|
||||
child: MyButton(
|
||||
onPressed: () {
|
||||
model.playVideo = !model.playVideo;
|
||||
if (model.playVideo) {
|
||||
model.nativeVideoPlayerController!.play();
|
||||
} else {
|
||||
model.nativeVideoPlayerController!.pause();
|
||||
}
|
||||
model.notifyListeners();
|
||||
},
|
||||
text: model.playVideo ? 'Pause' : 'Play',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import 'package:native_video_player/native_video_player.dart';
|
||||
import 'package:perumahan_bew/app/core/custom_base_view_model.dart';
|
||||
|
||||
class PlayVideoDialogViewModel extends CustomBaseViewModel {
|
||||
NativeVideoPlayerController? nativeVideoPlayerController;
|
||||
bool playVideo = true;
|
||||
Future<void> init() async {}
|
||||
}
|
||||
67
lib/ui/views/splash_screen/splash_screen_view.dart
Normal file
67
lib/ui/views/splash_screen/splash_screen_view.dart
Normal file
@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:perumahan_bew/app/themes/app_colors.dart';
|
||||
import 'package:perumahan_bew/app/themes/app_text.dart';
|
||||
import 'package:stacked/stacked.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: mainColor,
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/house.svg',
|
||||
width: MediaQuery.of(context).size.width * 0.5,
|
||||
height: MediaQuery.of(context).size.height * 0.5,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'APLIKASI PERUMAHAN \nMUTIARA ALGA',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: backgroundColor,
|
||||
fontSize: 20,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const Expanded(child: SizedBox()),
|
||||
Text(
|
||||
'Jl. Raya Mutiara Alga No. 1, \nKec. Ciputat, Kota Tangerang Selatan, \nBanten 15412',
|
||||
style: regularTextStyle.copyWith(
|
||||
color: backgroundColor,
|
||||
fontSize: 12,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
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 'package:perumahan_bew/app/core/custom_base_view_model.dart';
|
||||
|
||||
import '../../../app/app.logger.dart';
|
||||
import '../../../app/app.router.dart';
|
||||
|
||||
class SplashScreenViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('SplashScreenViewModel');
|
||||
Future<void> init() async {
|
||||
// await 3 seconds then go to login
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
await navigationService.navigateTo(Routes.loginScreenView);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,235 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:native_video_player/native_video_player.dart';
|
||||
import 'package:perumahan_bew/app/themes/app_text.dart';
|
||||
import 'package:perumahan_bew/ui/widgets/my_button.dart';
|
||||
import 'package:perumahan_bew/ui/widgets/my_textformfield.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 './tambah_lihat_progress_bottom_sheet_view_model.dart';
|
||||
|
||||
class TambahLihatProgressBottomSheetView extends StatelessWidget {
|
||||
final SheetRequest? request;
|
||||
final Function(SheetResponse)? completer;
|
||||
|
||||
const TambahLihatProgressBottomSheetView({
|
||||
Key? key,
|
||||
this.request,
|
||||
this.completer,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<TambahLihatProgressBottomSheetViewModel>.reactive(
|
||||
viewModelBuilder: () => TambahLihatProgressBottomSheetViewModel(),
|
||||
onViewModelReady: (TambahLihatProgressBottomSheetViewModel model) async {
|
||||
await model.init(request!.data);
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
TambahLihatProgressBottomSheetViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return WillPopScope(
|
||||
// if
|
||||
onWillPop: () async {
|
||||
if (model.globalVar.backPressed == 'exitApp') {
|
||||
// model.back();
|
||||
// model.quitApp(context);
|
||||
model.nativeVideoPlayerController?.pause();
|
||||
model.nativeVideoPlayerController?.removeListener(() {
|
||||
// model.nativeVideoPlayerController?.dispose();
|
||||
model.nativeVideoPlayerController = null;
|
||||
});
|
||||
model.nativeVideoPlayerController = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
// stop playing video
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
width: double.infinity,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(15),
|
||||
topRight: Radius.circular(15),
|
||||
),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Form(
|
||||
key: model.globalKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'${request!.title!} ${request!.data.toString().toUpperCase()}',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
// clipBehavior: Clip.none,
|
||||
height: 100,
|
||||
width: 150,
|
||||
padding: const EdgeInsets.all(2),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: mainColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: model.imageVideoBytes != null
|
||||
? (model.imageVideoType == 'image'
|
||||
? ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(10),
|
||||
child: GestureDetector(
|
||||
onTap: () =>
|
||||
model.showImage(context),
|
||||
child: Image.memory(
|
||||
model.imageVideoBytes!,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
)
|
||||
: ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(10),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 11,
|
||||
child: NativeVideoPlayerView(
|
||||
onViewReady: (controller) async {
|
||||
final videoSource =
|
||||
await VideoSource.init(
|
||||
path: model.imageVideoPath!,
|
||||
type: VideoSourceType.file,
|
||||
);
|
||||
await controller
|
||||
.loadVideoSource(
|
||||
videoSource);
|
||||
model.nativeVideoPlayerController =
|
||||
controller;
|
||||
model.notifyListeners();
|
||||
model
|
||||
.nativeVideoPlayerController!
|
||||
.play();
|
||||
// loop video
|
||||
model
|
||||
.nativeVideoPlayerController!
|
||||
.onPlaybackEnded
|
||||
.addListener(() {
|
||||
model
|
||||
.nativeVideoPlayerController!
|
||||
.seekTo(0);
|
||||
model
|
||||
.nativeVideoPlayerController!
|
||||
.play();
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
))
|
||||
: const Icon(
|
||||
Icons.credit_card_rounded,
|
||||
color: Colors.white,
|
||||
size: 50,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: CircleAvatar(
|
||||
radius: 15,
|
||||
backgroundColor: sixthGrey,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
model.pilihImageVideo();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
color: backgroundColor3,
|
||||
size: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
MyTextFormField(
|
||||
maxLines: 5,
|
||||
hintText: 'Masukkan Keterangan',
|
||||
labelText: 'Keterangan',
|
||||
controller: model.ketController,
|
||||
validator:
|
||||
Validatorless.required('Keterangan harus diisi'),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: 250,
|
||||
child: MyButton(
|
||||
text: 'Tambah Progress',
|
||||
onPressed: () {
|
||||
if (model.imageVideoBytes == null) {
|
||||
model.snackbarService.showSnackbar(
|
||||
message: 'Gambar/video harus diisi',
|
||||
);
|
||||
model.pilihImageVideo();
|
||||
return;
|
||||
}
|
||||
|
||||
if (model.globalKey.currentState!.validate()) {
|
||||
model.dialogService
|
||||
.showDialog(
|
||||
title: 'Tambah Progress',
|
||||
description: 'Apakah anda yakin?',
|
||||
buttonTitle: 'Ya',
|
||||
cancelTitle: 'Tidak',
|
||||
)
|
||||
.then((value) async {
|
||||
if (value!.confirmed) {
|
||||
// stop playing video
|
||||
model.nativeVideoPlayerController?.pause();
|
||||
model.nativeVideoPlayerController
|
||||
?.removeListener(() {
|
||||
// model.nativeVideoPlayerController?.dispose();
|
||||
model.nativeVideoPlayerController = null;
|
||||
});
|
||||
model.nativeVideoPlayerController = null;
|
||||
|
||||
// add progress
|
||||
bool res = await model.tambahProgress();
|
||||
model.log.i('res: $res');
|
||||
completer!(SheetResponse(
|
||||
confirmed: true,
|
||||
));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,131 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_image_viewer/easy_image_viewer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:native_video_player/native_video_player.dart';
|
||||
|
||||
import '../../../app/app.dialogs.dart';
|
||||
import '../../../app/app.logger.dart';
|
||||
import '../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../app/themes/app_colors.dart';
|
||||
|
||||
class TambahLihatProgressBottomSheetViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('TambahLihatProgressBottomSheetViewModel');
|
||||
|
||||
NativeVideoPlayerController? nativeVideoPlayerController;
|
||||
|
||||
String? idPerumahan;
|
||||
|
||||
// form variable
|
||||
final globalKey = GlobalKey<FormState>();
|
||||
TextEditingController? ketController = TextEditingController();
|
||||
|
||||
// image video variable
|
||||
// image picker
|
||||
String? imageVideoPath;
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
XFile? imageVideoFile;
|
||||
Uint8List? imageVideoBytes;
|
||||
String? imageVideoType;
|
||||
Future<void> init(String data) async {
|
||||
globalVar.backPressed = "exitApp";
|
||||
idPerumahan = data;
|
||||
}
|
||||
|
||||
addImage(String type) async {
|
||||
imageVideoType = type;
|
||||
try {
|
||||
XFile? imageVideo;
|
||||
if (type == 'image') {
|
||||
imageVideo = await _picker.pickImage(
|
||||
source: ImageSource.camera,
|
||||
);
|
||||
} else if (type == 'video') {
|
||||
imageVideo = await _picker.pickVideo(
|
||||
source: ImageSource.camera,
|
||||
);
|
||||
}
|
||||
if (imageVideo != null) {
|
||||
imageVideoFile = imageVideo;
|
||||
imageVideoPath = imageVideo.path;
|
||||
imageVideoBytes = await imageVideo.readAsBytes();
|
||||
|
||||
log.i('image path: $imageVideoPath');
|
||||
notifyListeners();
|
||||
}
|
||||
} catch (e) {
|
||||
log.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
pilihImageVideo() async {
|
||||
dialogService
|
||||
.showDialog(
|
||||
title: 'Image Video',
|
||||
description: 'Pilih Gambar atau Video',
|
||||
buttonTitle: 'Gambar',
|
||||
cancelTitle: 'Video',
|
||||
buttonTitleColor: mainColor,
|
||||
cancelTitleColor: mainColor,
|
||||
)
|
||||
.then((value) async {
|
||||
if (value!.confirmed) {
|
||||
await addImage('image');
|
||||
} else {
|
||||
await addImage('video');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
playVideo() async {
|
||||
// play video by imageVideoPath
|
||||
|
||||
await dialogService.showCustomDialog(
|
||||
variant: DialogType.playVideoDialogView,
|
||||
title: 'Video',
|
||||
data: imageVideoPath,
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> tambahProgress() async {
|
||||
globalVar.backPressed = "cantBack";
|
||||
setBusy(true);
|
||||
easyLoading.customLoading('Tambah Progress...');
|
||||
try {
|
||||
String? idMandor = await mySharedPrefs.getString('id');
|
||||
var formData = FormData.fromMap({
|
||||
'id_rumah': idPerumahan,
|
||||
'id_mandor': idMandor,
|
||||
'ket': ketController!.text,
|
||||
'image': await MultipartFile.fromFile(
|
||||
imageVideoPath!,
|
||||
filename: imageVideoFile!.name,
|
||||
),
|
||||
'type': imageVideoType,
|
||||
});
|
||||
await httpService.postWithFormData('pembangunan', formData);
|
||||
return true;
|
||||
} catch (e) {
|
||||
log.e(e.toString());
|
||||
return false;
|
||||
} finally {
|
||||
globalVar.backPressed = "exitApp";
|
||||
setBusy(false);
|
||||
easyLoading.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
showImage(BuildContext context) async {
|
||||
showImageViewer(
|
||||
context,
|
||||
Image.memory(
|
||||
imageVideoBytes!,
|
||||
fit: BoxFit.fill,
|
||||
).image,
|
||||
swipeDismissible: true,
|
||||
doubleTapZoomable: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
69
lib/ui/views/user_index/user_home/user_home_view.dart
Normal file
69
lib/ui/views/user_index/user_home/user_home_view.dart
Normal file
@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import './user_home_view_model.dart';
|
||||
|
||||
class UserHomeView extends StatelessWidget {
|
||||
const UserHomeView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<UserHomeViewModel>.nonReactive(
|
||||
viewModelBuilder: () => UserHomeViewModel(),
|
||||
onViewModelReady: (UserHomeViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
disposeViewModel: false,
|
||||
fireOnViewModelReadyOnce: true,
|
||||
builder: (
|
||||
BuildContext context,
|
||||
UserHomeViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
body: WebView(
|
||||
// initialUrl: 'http://192.168.43.125/rekam-medis',
|
||||
initialUrl: 'http://20.20.20.25/perumahan',
|
||||
javascriptMode: JavascriptMode.unrestricted,
|
||||
onWebViewCreated: (WebViewController webViewController) {
|
||||
// _controller.complete(webViewController);
|
||||
model.webViewControllerCompleter.future
|
||||
.then((value) => model.webVIewcontroller = value);
|
||||
model.webViewControllerCompleter.complete(webViewController);
|
||||
},
|
||||
onProgress: (int progress) {
|
||||
double progressDouble = progress / 100;
|
||||
model.myEasyLoading.showProgress(progressDouble, "Loading Denah");
|
||||
},
|
||||
// javascriptChannels: <JavascriptChannel>{
|
||||
// _toasterJavascriptChannel(context),
|
||||
// },
|
||||
javascriptChannels: <JavascriptChannel>{
|
||||
JavascriptChannel(
|
||||
name: 'messageHandler',
|
||||
onMessageReceived: (JavascriptMessage message) {
|
||||
model.log.d(message.message);
|
||||
// dev.i("message from the web view=\"${message.message}\"");
|
||||
// if (message.message == "coba") {
|
||||
// dev.i("sini untuk coba");
|
||||
// controller.runJavascript("coba22('heheheh')");
|
||||
// }
|
||||
},
|
||||
),
|
||||
},
|
||||
// navigationDelegate: (NavigationRequest request) async {},
|
||||
onPageStarted: (String url) {},
|
||||
onPageFinished: (String url) {
|
||||
// dev.i('Page finished loading: $url');
|
||||
model.myEasyLoading.dismissLoading();
|
||||
},
|
||||
|
||||
gestureNavigationEnabled: true,
|
||||
backgroundColor: const Color(0x00000000),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
25
lib/ui/views/user_index/user_home/user_home_view_model.dart
Normal file
25
lib/ui/views/user_index/user_home/user_home_view_model.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import '../../../../app/app.locator.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../services/my_easyloading.dart';
|
||||
|
||||
class UserHomeViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('UserHomeViewModel');
|
||||
final _myEasyLoading = locator<MyEasyLoading>();
|
||||
|
||||
get myEasyLoading => _myEasyLoading;
|
||||
late WebViewController webVIewcontroller;
|
||||
final Completer<WebViewController> webViewControllerCompleter =
|
||||
Completer<WebViewController>();
|
||||
|
||||
Future<void> init() async {
|
||||
if (Platform.isAndroid) {
|
||||
WebView.platform = SurfaceAndroidWebView();
|
||||
}
|
||||
}
|
||||
}
|
||||
84
lib/ui/views/user_index/user_index_view.dart
Normal file
84
lib/ui/views/user_index/user_index_view.dart
Normal file
@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:perumahan_bew/app/app.router.dart';
|
||||
import 'package:perumahan_bew/app/themes/app_colors.dart';
|
||||
import 'package:perumahan_bew/app/themes/app_text.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 './user_index_view_model.dart';
|
||||
|
||||
class UserIndexView extends StatelessWidget {
|
||||
const UserIndexView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<UserIndexViewModel>.reactive(
|
||||
viewModelBuilder: () => UserIndexViewModel(),
|
||||
onViewModelReady: (UserIndexViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
disposeViewModel: false,
|
||||
fireOnViewModelReadyOnce: true,
|
||||
builder: (
|
||||
BuildContext context,
|
||||
UserIndexViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
model.header,
|
||||
style: boldTextStyle.copyWith(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
backgroundColor: mainColor,
|
||||
elevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
// extendBody: true,
|
||||
body: ExtendedNavigator(
|
||||
navigatorKey: StackedService.nestedNavigationKey(2),
|
||||
router: UserIndexViewRouter(),
|
||||
),
|
||||
bottomNavigationBar: StylishBottomBar(
|
||||
items: [
|
||||
for (var item in model.bottomNavBarList)
|
||||
BottomBarItem(
|
||||
icon: Icon(item['icon'],
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? mainColor
|
||||
: backgroundColor),
|
||||
title: Text(
|
||||
item['name'],
|
||||
style: regularTextStyle.copyWith(
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? mainColor
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
backgroundColor:
|
||||
model.currentIndex == model.bottomNavBarList.indexOf(item)
|
||||
? Colors.white
|
||||
: Colors.grey,
|
||||
),
|
||||
],
|
||||
currentIndex: model.currentIndex,
|
||||
option: BubbleBarOptions(),
|
||||
hasNotch: true,
|
||||
backgroundColor: mainColor,
|
||||
onTap: (value) {
|
||||
model.handleNavigation(value);
|
||||
},
|
||||
// fabLocation: StylishBarFabLocation.center,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
49
lib/ui/views/user_index/user_index_view_model.dart
Normal file
49
lib/ui/views/user_index/user_index_view_model.dart
Normal file
@ -0,0 +1,49 @@
|
||||
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';
|
||||
|
||||
class UserIndexViewModel extends IndexTrackingViewModel {
|
||||
final log = getLogger('UserIndexViewModel');
|
||||
final _navigationService = locator<NavigationService>();
|
||||
|
||||
final _bottomNavBarList = [
|
||||
{
|
||||
'name': 'List',
|
||||
'icon': Icons.list_alt_rounded,
|
||||
'header': 'List Perumahan'
|
||||
},
|
||||
{'name': 'Denah', 'icon': Icons.home_outlined, 'header': 'Denah Perumahan'},
|
||||
{'name': 'Profil', 'icon': Icons.person_outline, 'header': 'Profil'},
|
||||
];
|
||||
List<Map<String, dynamic>> get bottomNavBarList => _bottomNavBarList;
|
||||
|
||||
final List<String> _views = [
|
||||
UserIndexViewRoutes.userListPembangunanView,
|
||||
UserIndexViewRoutes.userHomeView,
|
||||
UserIndexViewRoutes.userProfileView,
|
||||
];
|
||||
|
||||
String header = 'Denah Perumahan';
|
||||
|
||||
Future<void> init() async {
|
||||
setIndex(1);
|
||||
}
|
||||
|
||||
void handleNavigation(int index) {
|
||||
log.d("handleNavigation: $index");
|
||||
log.d("currentIndex: ${_views[index]}");
|
||||
|
||||
if (currentIndex == index) return;
|
||||
|
||||
setIndex(index);
|
||||
header = _bottomNavBarList[index]['header'] as String;
|
||||
_navigationService.navigateTo(
|
||||
_views[index],
|
||||
id: 2,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
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 './user_list_pembangunan_view_model.dart';
|
||||
|
||||
class UserListPembangunanView extends StatelessWidget {
|
||||
const UserListPembangunanView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<UserListPembangunanViewModel>.reactive(
|
||||
viewModelBuilder: () => UserListPembangunanViewModel(),
|
||||
onViewModelReady: (UserListPembangunanViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
UserListPembangunanViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MyTopWidget(
|
||||
icon: Icons.list_alt_outlined,
|
||||
title: 'Pembangunan',
|
||||
subtitle: '15 kali',
|
||||
// lastUpdate: '31/02/15 - 10.00 am',
|
||||
),
|
||||
MyTopWidget(
|
||||
icon: Icons.home,
|
||||
title: 'Progress',
|
||||
subtitle: '76 %',
|
||||
// lastUpdate: '31/02/15 - 10.00 am',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
spreadRadius: 5,
|
||||
blurRadius: 7,
|
||||
// offset: Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
// create a listview with 20 dummy data on card and scrollable
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 10),
|
||||
itemCount: 20,
|
||||
itemBuilder: (context, index) {
|
||||
return Card(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
model.log.i('Card $index tapped');
|
||||
},
|
||||
child: ListTile(
|
||||
title: Text('1/02/15 - 10.00 am',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13, color: mainColor)),
|
||||
subtitle: Text('Progress $index'),
|
||||
trailing: Text('Pembangunan $index'),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import 'package:perumahan_bew/app/core/custom_base_view_model.dart';
|
||||
|
||||
import '../../../../app/app.logger.dart';
|
||||
|
||||
class UserListPembangunanViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('UserListPembangunanViewModel');
|
||||
Future<void> init() async {}
|
||||
}
|
||||
155
lib/ui/views/user_index/user_profile/user_profile_view.dart
Normal file
155
lib/ui/views/user_index/user_profile/user_profile_view.dart
Normal file
@ -0,0 +1,155 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:perumahan_bew/app/themes/app_colors.dart';
|
||||
import 'package:perumahan_bew/app/themes/app_text.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import './user_profile_view_model.dart';
|
||||
|
||||
class UserProfileView extends StatelessWidget {
|
||||
const UserProfileView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<UserProfileViewModel>.reactive(
|
||||
viewModelBuilder: () => UserProfileViewModel(),
|
||||
onViewModelReady: (UserProfileViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
UserProfileViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
// create a rounded container
|
||||
Center(
|
||||
child: Container(
|
||||
width: 150,
|
||||
height: 150,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
image: const NetworkImage(
|
||||
'http://kicap-karan.com/assets/img/me.jpg',
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
onError: (exception, stackTrace) {
|
||||
model.log.e('Error: $exception');
|
||||
},
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 7,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
'Kicap Karan',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 30, vertical: 10),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
for (var i = 0; i < 10; i++) const _DetailChild(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 15,
|
||||
right: 65,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
model.log.i('Edit Profile');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.edit,
|
||||
color: mainColor,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 15,
|
||||
right: 15,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
model.log.i('Logout');
|
||||
model.logout();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.logout,
|
||||
color: mainColor,
|
||||
size: 30,
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DetailChild extends StatelessWidget {
|
||||
const _DetailChild({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 25),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.maps_home_work_outlined,
|
||||
color: mainColor,
|
||||
size: 40,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Text(
|
||||
'Jln 2, Blok C, No 2',
|
||||
style: regularTextStyle.copyWith(
|
||||
fontSize: 15,
|
||||
color: mainGrey,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
import 'package:perumahan_bew/app/core/custom_base_view_model.dart';
|
||||
|
||||
import '../../../../app/app.logger.dart';
|
||||
|
||||
class UserProfileViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('UserProfileViewModel');
|
||||
|
||||
Future<void> init() async {}
|
||||
|
||||
logout() {
|
||||
log.i('logout');
|
||||
navigationService.pushNamedAndRemoveUntil('/login-screen-view');
|
||||
}
|
||||
}
|
||||
33
lib/ui/widgets/my_button.dart
Normal file
33
lib/ui/widgets/my_button.dart
Normal file
@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:perumahan_bew/app/themes/app_colors.dart';
|
||||
|
||||
class MyButton extends StatelessWidget {
|
||||
const MyButton({
|
||||
Key? key,
|
||||
required this.text,
|
||||
this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
final String text;
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: mainColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
color: backgroundColor,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
81
lib/ui/widgets/my_textformfield.dart
Normal file
81
lib/ui/widgets/my_textformfield.dart
Normal file
@ -0,0 +1,81 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:perumahan_bew/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.readOnly = false,
|
||||
this.onTap,
|
||||
}) : 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 bool readOnly;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
onTap: onTap,
|
||||
readOnly: readOnly,
|
||||
keyboardType: keyboardType,
|
||||
onEditingComplete: onEditingComplete,
|
||||
maxLines: maxLines,
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
obscureText: obscureText ?? false,
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
90
lib/ui/widgets/top_container.dart
Normal file
90
lib/ui/widgets/top_container.dart
Normal file
@ -0,0 +1,90 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../app/themes/app_colors.dart';
|
||||
import '../../app/themes/app_text.dart';
|
||||
|
||||
class MyTopWidget extends StatelessWidget {
|
||||
const MyTopWidget({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
// required this.lastUpdate,
|
||||
}) : super(key: key);
|
||||
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final String subtitle;
|
||||
// final String lastUpdate;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||
width: MediaQuery.of(context).size.width * 0.42,
|
||||
decoration: BoxDecoration(
|
||||
color: mainColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
spreadRadius: 5,
|
||||
blurRadius: 7,
|
||||
// offset: Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: mainColor.withAlpha(100),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.7),
|
||||
// spreadRadius: 5,
|
||||
// blurRadius: 7,
|
||||
// offset: Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: backgroundColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
title,
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: backgroundColor,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
subtitle,
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
color: backgroundColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
// Text(
|
||||
// lastUpdate,
|
||||
// style: regularTextStyle.copyWith(
|
||||
// fontSize: 11,
|
||||
// color: backgroundColor,
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user