Skip to content

Commit

Permalink
style(format): run dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanaidilp committed Feb 24, 2025
1 parent b120f0f commit 6a6bda7
Show file tree
Hide file tree
Showing 224 changed files with 8,436 additions and 11,861 deletions.
39 changes: 18 additions & 21 deletions app/example/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,23 @@ class App extends StatelessWidget {

@override
Widget build(BuildContext context) => MediaQuery(
data: MediaQueryData.fromView(View.of(context)),
child: LayoutBuilder(
builder: (context, constraints) {
ScreenUtil.init(
context,
designSize: Size(
constraints.maxWidth,
constraints.maxHeight,
),
);
data: MediaQueryData.fromView(View.of(context)),
child: LayoutBuilder(
builder: (context, constraints) {
ScreenUtil.init(
context,
designSize: Size(constraints.maxWidth, constraints.maxHeight),
);

return GetMaterialApp(
title: 'Stadata Example',
initialRoute: AppPages.INITIAL,
getPages: AppPages.routes,
translationsKeys: AppTranslation.translations,
locale: Get.deviceLocale,
fallbackLocale: const Locale('id', 'ID'),
);
},
),
);
return GetMaterialApp(
title: 'Stadata Example',
initialRoute: AppPages.INITIAL,
getPages: AppPages.routes,
translationsKeys: AppTranslation.translations,
locale: Get.deviceLocale,
fallbackLocale: const Locale('id', 'ID'),
);
},
),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import '../controllers/domain_controller.dart';
class DomainBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<DomainController>(
() => DomainController(),
);
Get.lazyPut<DomainController>(() => DomainController());
}
}
128 changes: 44 additions & 84 deletions app/example/lib/app/modules/domain/views/domain_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ class DomainView extends GetView<DomainController> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
LocaleKeys.page_domain.tr,
),
centerTitle: true,
),
appBar: AppBar(title: Text(LocaleKeys.page_domain.tr), centerTitle: true),
body: Padding(
padding: EdgeInsets.all(8.r),
child: Column(
Expand All @@ -40,14 +35,15 @@ class DomainView extends GetView<DomainController> {
labelText: LocaleKeys.label_type.tr,
),
value: controller.selectedType.value,
items: DomainType.values
.map(
(e) => DropdownMenuItem<DomainType>(
value: e,
child: Text('${e.name} - ${e.value}'),
),
)
.toList(),
items:
DomainType.values
.map(
(e) => DropdownMenuItem<DomainType>(
value: e,
child: Text('${e.name} - ${e.value}'),
),
)
.toList(),
onChanged: (selectedType) {
if (selectedType == null) return;

Expand All @@ -58,7 +54,8 @@ class DomainView extends GetView<DomainController> {
16.verticalSpace,
Obx(
() => TextFormField(
enabled: controller.selectedType.value ==
enabled:
controller.selectedType.value ==
DomainType.regencyByProvince,
maxLength: 2,
onChanged: (value) => controller.provinceCode.value = value,
Expand All @@ -78,9 +75,7 @@ class DomainView extends GetView<DomainController> {
FocusScope.of(context).unfocus();
controller.loadDomains();
},
child: Text(
LocaleKeys.button_submit.tr,
),
child: Text(LocaleKeys.button_submit.tr),
),
),
16.verticalSpace,
Expand All @@ -96,41 +91,27 @@ class DomainView extends GetView<DomainController> {
child: Row(
children: [
Text(
LocaleKeys.label_pagination_page.trParams(
{
'page': '${state?.pagination?.page ?? 0}',
},
),
),
const VerticalDivider(
color: Colors.blueGrey,
LocaleKeys.label_pagination_page.trParams({
'page': '${state?.pagination?.page ?? 0}',
}),
),
const VerticalDivider(color: Colors.blueGrey),
Text(
LocaleKeys.label_pagination_pages.trParams(
{
'pages': '${state?.pagination?.pages ?? 0}',
},
),
),
const VerticalDivider(
color: Colors.blueGrey,
LocaleKeys.label_pagination_pages.trParams({
'pages': '${state?.pagination?.pages ?? 0}',
}),
),
const VerticalDivider(color: Colors.blueGrey),
Text(
LocaleKeys.label_pagination_per_page.trParams(
{
'per_page': '${state?.pagination?.perPage ?? 0}',
},
),
),
const VerticalDivider(
color: Colors.blueGrey,
LocaleKeys.label_pagination_per_page.trParams({
'per_page': '${state?.pagination?.perPage ?? 0}',
}),
),
const VerticalDivider(color: Colors.blueGrey),
Text(
LocaleKeys.label_pagination_total.trParams(
{
'total': '${state?.pagination?.total ?? 0}',
},
),
LocaleKeys.label_pagination_total.trParams({
'total': '${state?.pagination?.total ?? 0}',
}),
),
],
),
Expand All @@ -143,27 +124,13 @@ class DomainView extends GetView<DomainController> {
scrollDirection: Axis.horizontal,
child: Row(
children: [
Text(
'Page : ',
),
VerticalDivider(
color: Colors.blueGrey,
),
Text(
'Pages : ',
),
VerticalDivider(
color: Colors.blueGrey,
),
Text(
'Per Page : ',
),
VerticalDivider(
color: Colors.blueGrey,
),
Text(
'Total : ',
),
Text('Page : '),
VerticalDivider(color: Colors.blueGrey),
Text('Pages : '),
VerticalDivider(color: Colors.blueGrey),
Text('Per Page : '),
VerticalDivider(color: Colors.blueGrey),
Text('Total : '),
],
),
),
Expand Down Expand Up @@ -198,26 +165,19 @@ class DomainView extends GetView<DomainController> {
enabled: true,
child: ListView.separated(
separatorBuilder: (_, __) => const Divider(),
itemBuilder: (_, __) => const DomainCard(
id: '0000',
title: 'Provinsi Dummy',
url: 'https://provinsi.com',
),
itemBuilder:
(_, __) => const DomainCard(
id: '0000',
title: 'Provinsi Dummy',
url: 'https://provinsi.com',
),
itemCount: 10,
),
),
),
onError: (error) => Center(
child: Text(
error.toString(),
),
),
onEmpty: Center(
child: Text(
LocaleKeys.label_empty.tr,
),
),
)
onError: (error) => Center(child: Text(error.toString())),
onEmpty: Center(child: Text(LocaleKeys.label_empty.tr)),
),
],
),
),
Expand Down
4 changes: 1 addition & 3 deletions app/example/lib/app/modules/home/bindings/home_binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import '../controllers/home_controller.dart';
class HomeBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<HomeController>(
() => HomeController(),
);
Get.lazyPut<HomeController>(() => HomeController());
}
}
44 changes: 20 additions & 24 deletions app/example/lib/app/modules/home/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@ class HomeView extends GetView<HomeController> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
LocaleKeys.stadata_example.tr,
),
title: Text(LocaleKeys.stadata_example.tr),
centerTitle: true,
actions: [
ValueBuilder<Locale?>(
initialValue: Get.deviceLocale,
builder: (snapshot, updater) => FlutterSwitch(
value: snapshot == const Locale('id', 'ID'),
showOnOff: true,
onToggle: (value) {
final locale =
value ? const Locale('id', 'ID') : const Locale('en', 'US');
Get.updateLocale(locale);
updater.call(locale);
},
activeText: 'ID',
inactiveText: 'EN',
),
)
builder:
(snapshot, updater) => FlutterSwitch(
value: snapshot == const Locale('id', 'ID'),
showOnOff: true,
onToggle: (value) {
final locale =
value
? const Locale('id', 'ID')
: const Locale('en', 'US');
Get.updateLocale(locale);
updater.call(locale);
},
activeText: 'ID',
inactiveText: 'EN',
),
),
],
),
body: ListView(
Expand All @@ -47,10 +48,7 @@ class HomeView extends GetView<HomeController> {
_Button(LocaleKeys.features_domains.tr, Routes.DOMAIN),
_Button(LocaleKeys.features_infographics.tr, Routes.INFOGRAPHIC),
_Button(LocaleKeys.features_news.tr, Routes.NEWS),
_Button(
LocaleKeys.features_news_categories.tr,
Routes.NEWS_CATEGORY,
),
_Button(LocaleKeys.features_news_categories.tr, Routes.NEWS_CATEGORY),
_Button(LocaleKeys.features_press_releases.tr, Routes.PRESS_RELEASE),
_Button(LocaleKeys.features_publications.tr, Routes.PUBLICATION),
_Button(LocaleKeys.features_static_tables.tr, Routes.STATIC_TABLE),
Expand Down Expand Up @@ -86,8 +84,6 @@ class _Button extends StatelessWidget {
final String route;

@override
Widget build(BuildContext context) => FilledButton(
onPressed: () => Get.toNamed(route),
child: Text(label),
);
Widget build(BuildContext context) =>
FilledButton(onPressed: () => Get.toNamed(route), child: Text(label));
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import '../controllers/infographic_controller.dart';
class InfographicBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<InfographicController>(
() => InfographicController(),
);
Get.lazyPut<InfographicController>(() => InfographicController());
}
}
Loading

0 comments on commit 6a6bda7

Please sign in to comment.