All Projects → hongvinhmobile → flutter_getx_template

hongvinhmobile / flutter_getx_template

Licence: MIT license
🍻🍀 This is source base for getx flutter. Optimize by lambiengcode

Programming Languages

dart
5743 projects
CMake
9771 projects
C++
36643 projects - #6 most used programming language
HTML
75241 projects
ruby
36898 projects - #4 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to flutter getx template

Awesome Stock Resources
🌇 A collection of links for free stock photography, video and Illustration websites
Stars: ✭ 10,162 (+23532.56%)
Mutual labels:  patterns, templates
flutter ducafecat news getx
flutter2 + dio4 + getx4
Stars: ✭ 283 (+558.14%)
Mutual labels:  getx, getxpattern
Vogen
A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Stars: ✭ 240 (+458.14%)
Mutual labels:  patterns
redis-patterns-console
An interactive (and reactive) console to try and go into the deep of Redis and its patterns!
Stars: ✭ 22 (-48.84%)
Mutual labels:  patterns
section-matter
Like front-matter, but allows multiple sections in a single document.
Stars: ✭ 18 (-58.14%)
Mutual labels:  templates
ProvToolbox
Java library to create and convert W3C PROV data model representations
Stars: ✭ 62 (+44.19%)
Mutual labels:  templates
cgol
Conway's Game of Life in the Terminal
Stars: ✭ 32 (-25.58%)
Mutual labels:  patterns
ui patterns
[NOTE] Development has moved to https://drupal.org/project/ui_patterns
Stars: ✭ 87 (+102.33%)
Mutual labels:  patterns
ConvNet-OOP
ConvNet Implementation: An Object Oriented Approach using Keras API.
Stars: ✭ 20 (-53.49%)
Mutual labels:  templates
getx-snippets-intelliJ
An extension to accelerate the process of developing applications with flutter, aimed at everyone using the GetX package.
Stars: ✭ 52 (+20.93%)
Mutual labels:  getx
CPTH
🌟 Competitive Programming Template Headers | With documentation, CI tests and Codecov
Stars: ✭ 23 (-46.51%)
Mutual labels:  templates
grafana-dashboards
Collection of reusable Grafana dashboards
Stars: ✭ 55 (+27.91%)
Mutual labels:  templates
machine-learning-templates
Template codes and examples for Python machine learning concepts
Stars: ✭ 40 (-6.98%)
Mutual labels:  templates
laravel-email-templates
Laravel 5 database driven email templates
Stars: ✭ 23 (-46.51%)
Mutual labels:  templates
dotnet-new-nunit
Project is being maintained by the .NET Team now
Stars: ✭ 33 (-23.26%)
Mutual labels:  templates
ACCESS-NYC-PATTERNS
ACCESS NYC Pattern library and design system documentation for https://access.nyc.gov. Maintained by @NYCOpportunity
Stars: ✭ 14 (-67.44%)
Mutual labels:  patterns
container-apps-connect-multiple-apps
Azure Sample showing how to connect and call multiple container apps within the same environment. Shows the approach to use both with and without Dapr.
Stars: ✭ 41 (-4.65%)
Mutual labels:  patterns
dotfiles
These are my dotfiles. All the config stuff that I use is here.
Stars: ✭ 16 (-62.79%)
Mutual labels:  templates
smart-github
A chrome extension to further upgrade github's template
Stars: ✭ 17 (-60.47%)
Mutual labels:  templates
hypertag
HTML templates with Python-like concise syntax, code reuse & modularity. The Pythonic way to web templating.
Stars: ✭ 27 (-37.21%)
Mutual labels:  templates

Flutter Getx Template

Description:

  • This is source flutter template use getx for statemanagement

👀 Overview main.dart, After you can customize languages package, themes, pages and routes

import 'package:flutter/material.dart';
import 'package:get_boilerplate/src/lang/translation_service.dart';
import 'package:get_boilerplate/src/routes/app_pages.dart';
import 'package:get_boilerplate/src/shared/logger/logger_utils.dart';
import 'package:get_boilerplate/src/theme/theme_service.dart';
import 'package:get_boilerplate/src/theme/themes.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';

void main() async {
  await GetStorage.init();
  runApp(GetMaterialApp(
    debugShowCheckedModeBanner: false,
    enableLog: true,
    logWriterCallback: Logger.write,
    initialRoute: AppPages.INITIAL,
    getPages: AppPages.routes,
    locale: TranslationService.locale,
    fallbackLocale: TranslationService.fallbackLocale,
    translations: TranslationService(),
    theme: Themes().lightTheme,
    darkTheme: Themes().darkTheme,
    themeMode: ThemeService().getThemeMode(),
  ));
}

🏴󠁧󠁢󠁥󠁮󠁧󠁿 Customize languages package

  • translation_service.dart
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'en_US.dart';
import 'vi_VN.dart';

class TranslationService extends Translations {
  static final locale = Get.deviceLocale;
  static final fallbackLocale = Locale('en', 'US');
  @override
  Map<String, Map<String, String>> get keys => {
        'en_US': en_US,
        'vi_VN': vi_VN,
      };
}
  • en_US.dart
const Map<String, String> en_US = {
  'helloWord': 'Hello World',
};
  • 🔥 similar to other language files

🌓 Customize theme package

  • themes.dart
import 'package:flutter/material.dart';
import 'package:get_boilerplate/src/public/styles.dart';

class Themes {
  final lightTheme = ThemeData.light().copyWith(
    primaryColor: colorPrimary,
    appBarTheme: AppBarTheme(
      brightness: Brightness.light,
      textTheme: TextTheme(
        headline2: TextStyle(color: colorTitle),
      ),
    ),
  );
  final darkTheme = ThemeData.dark().copyWith(
    primaryColor: colorPrimary,
    appBarTheme: AppBarTheme(
      brightness: Brightness.dark,
      textTheme: TextTheme(
        headline2: TextStyle(color: mC),
      ),
    ),
  );
}

🌞 save theme mode in device storage

  • theme_service.dart
import 'package:flutter/material.dart';
import 'package:get_storage/get_storage.dart';
import 'package:get/get.dart';

class ThemeService {
  final _getStorage = GetStorage();
  final storageKey = 'isDarkMode';

  ThemeMode getThemeMode() {
    return isSavedDarkMode() ? ThemeMode.dark : ThemeMode.light;
  }

  bool isSavedDarkMode() {
    return _getStorage.read(storageKey) ?? false;
  }

  void saveThemeMode(bool isDarkMode) {
    _getStorage.write(storageKey, isDarkMode);
  }

  void changeThemeMode() {
    Get.changeThemeMode(isSavedDarkMode() ? ThemeMode.light : ThemeMode.dark);
    saveThemeMode(!isSavedDarkMode());
  }
}

</> Log error for dev

  • logger_utils.dart
class Logger {
  static void write(String text, {bool isError = false}) {
    Future.microtask(() => print('** $text. isError: [$isError]'));
  }
}

🔗 Management routes

  • app_routes.dart
part of 'app_pages.dart';

abstract class Routes {
  static const ROOT = '/root';
  static const HOME = '/home';
}

📂 Management pages

  • app_pages.dart
import 'package:get_boilerplate/src/app.dart';
import 'package:get/get.dart';
part 'app_routes.dart';

// ignore: avoid_classes_with_only_static_members
class AppPages {
  static const INITIAL = Routes.ROOT;

  static final routes = [
    GetPage(
      name: Routes.ROOT,
      page: () => App(),
      children: [],
    ),
  ];
}

How I can run it?

  • 🚀 flutter version < 2.0 (1.x.x), not support null safety
  • 🚀 clone this repository
  • 🚀 run below code in terminal
flutter pub get
flutter run

Lib use in project:

get_test: ^3.13.3
get_storage: ^1.4.0

Author:

lambiengcode
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].