-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from ryanaidilp/release/0.4.0
feat: release 0.4.0
- Loading branch information
Showing
65 changed files
with
3,316 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
example/lib/app/modules/static_table/bindings/static_table_binding.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'package:get/get.dart'; | ||
|
||
import '../controllers/static_table_controller.dart'; | ||
|
||
class StaticTableBinding extends Bindings { | ||
@override | ||
void dependencies() { | ||
Get.lazyPut<StaticTableController>( | ||
() => StaticTableController(), | ||
); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
example/lib/app/modules/static_table/controllers/static_table_controller.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:stadata_flutter_sdk/stadata_flutter_sdk.dart'; | ||
|
||
class StaticTableController extends GetxController | ||
with StateMixin<ListResult<StaticTable>> { | ||
final selectedLang = Rx(DataLanguage.id); | ||
final domain = Rx<String>('7200'); | ||
final keyword = Rxn<String>(); | ||
final page = Rx<String>('1'); | ||
final date = Rxn<DateTime>(); | ||
final TextEditingController dateCtl = TextEditingController(); | ||
|
||
@override | ||
void onInit() { | ||
loadStaticTables(); | ||
super.onInit(); | ||
} | ||
|
||
Future loadStaticTables() async { | ||
try { | ||
change(null, status: RxStatus.loading()); | ||
final result = await StadataFlutter.instance.list.staticTables( | ||
domain: domain.value, | ||
lang: selectedLang.value, | ||
keyword: keyword.value, | ||
page: int.parse(page.value), | ||
year: date.value != null ? date.value!.year : null, | ||
month: date.value != null ? date.value!.month : null, | ||
); | ||
|
||
if (result.data.isEmpty) { | ||
change(null, status: RxStatus.empty()); | ||
} else { | ||
change(result, status: RxStatus.success()); | ||
} | ||
} catch (e) { | ||
change(null, status: RxStatus.error(e.toString())); | ||
} | ||
} | ||
|
||
@override | ||
void onClose() { | ||
dateCtl.dispose(); | ||
super.onClose(); | ||
} | ||
} |
Oops, something went wrong.