get_help 0.0.1 get_help: ^0.0.1 copied to clipboard
A set of helper widgets to clean up your project using GetX State management.
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'app/routes/app_pages.dart';
final scaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>();
/// The folder structure for this app was generated by the amazing
/// [get_cli](https://pub.dev/packages/get_cli) package. Please do note the
/// get_cli fields at the bottom of the pubspec.yaml file:
///
/// ```yaml
/// get_cli:
/// sub_folder: false
/// ```
///
/// This is defined to tell the generator to create pages without subfolders
/// which is more in line with how Getx_pattern was designed.
void main() {
runApp(
GetMaterialApp(
title: 'GetHelp Example',
initialRoute: AppPages.INITIAL,
getPages: AppPages.routes,
theme: ThemeData(
colorSchemeSeed: const Color(0xFF3f004b),
useMaterial3: true,
brightness: Brightness.light,
),
darkTheme: ThemeData(
colorSchemeSeed: const Color(0xFF3f004b),
useMaterial3: true,
brightness: Brightness.dark,
),
themeMode: ThemeMode.system,
scaffoldMessengerKey: scaffoldMessengerKey,
),
);
}
// // All of the below files are in `main.dart` simply for example purposes.
// // Normally, the home binding, controller and view would be found in
// // `lib/app/modules/home'.
// /// A binding is a way of initialising controllers on page load, if using
// /// reactive state management, all you'll need to do is use state management.
// class HomeBinding extends Bindings {
// @override
// void dependencies() {
// Get.lazyPut<HomeController>(() => HomeController());
// Get.lazyPut<TestController>(() => TestController());
// }
// }
// class TestController extends GetxController {
// late final Timer timer;
// int i = 0;
// @override
// void onInit() {
// timer = Timer.periodic(const Duration(seconds: 1), (_) {
// i++;
// update();
// });
// super.onInit();
// }
// @override
// void onClose() {
// timer.cancel();
// super.onClose();
// }
// }
// class HomeController extends GetxReactiveController {
// final testController = Get.find<TestController>();
// // late final Map<String, dynamic> data;
// // @override
// // Future<String?> futureToRun() async {
// // try {
// // // This is a simple simulation of waiting for an api call
// // await Future.delayed(const Duration(seconds: 2));
// // // this is a simulated response
// // data = {'dummy': 'data'};
// // // To simulate an error, just do this:
// // } catch (e) {
// // return e.toString();
// // }
// // return null;
// // }
// @override
// List<GetxController> get listenTo => [testController];
// }
// class HomeView extends GetBuilderView<HomeController> {
// const HomeView({super.key});
// // @override
// // HomeController? get init => HomeController();
// // @override
// // bool get global => true;
// @override
// Widget builder(context, controller) {
// return Scaffold(
// appBar: AppBar(title: const Text('HomeView')),
// body: ListView(
// children: [
// ElevatedButton(
// onPressed: () => Get.toNamed(Routes.REACTIVE),
// child: const Text('Reactive View'),
// ),
// ],
// ),
// );
// }
// }