Mobile Development 21 min read

GetX Scaffold: A Rapid Development Scaffold for Flutter

GetX Scaffold is a rapid development scaffold built on the GetX framework for Flutter, offering a comprehensive template with global methods, extensions, widgets, internationalization, and network utilities to accelerate app development across multiple Flutter versions.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
GetX Scaffold: A Rapid Development Scaffold for Flutter

GetX Scaffold Overview

GetX Scaffold is a fast‑development scaffold that extends the GetX framework and common Flutter plugins to provide a complete template for building Flutter applications. It bundles global helper methods, extension utilities, ready‑made widgets, internationalization support, and a wrapped Dio network layer.

Flutter Version Compatibility

Version

Flutter Version

0.0.3

3.19.5

0.0.4

3.22.2

0.1.2

3.24.0

Running the Example Project

cd example
flutter pub get
flutter run

# If you see "Error: Type 'UnmodifiableUint8ListView' not found", upgrade win32
flutter pub upgrade win32

Quick Start

1. Add Dependency

dependencies:
  getx_scaffold: ^0.0.1

  # Add localization support if needed
  flutter_localizations:
    sdk: flutter

2. Initialize Scaffold

import 'package:getx_scaffold/getx_scaffold.dart';

void main() async {
  WidgetsBinding widgetsBinding = await init(
    isDebug: kDebugMode,
    logTag: 'GetxScaffold',
    supportedLocales: TranslationLibrary.supportedLocales,
  );
  runApp(
    GetxApp(
      designSize: const Size(390, 844),
      enableLog: kDebugMode,
      defaultTransition: Transition.rightToLeft,
      themeMode: GlobalService.to.themeMode,
      theme: AppTheme.light,
      darkTheme: AppTheme.dark,
      locale: GlobalService.to.locale,
      translations: TranslationLibrary(),
      fallbackLocale: TranslationLibrary.fallbackLocale,
      supportedLocales: TranslationLibrary.supportedLocales,
      localizationsDelegates: TranslationLibrary.localizationsDelegates,
      title: 'GetxScaffold',
      home: const HomePage(),
      builder: (context, widget) => widget!,
    ),
  );
}

The GetxApp wraps GetMaterialApp with ScreenUtilInit for screen adaptation and provides global theme and locale handling.

3. Define Theme

import 'package:flutter/material.dart';

class AppTheme {
  static const String fontMontserrat = 'Montserrat';
  static const Color themeColor = Color.fromARGB(255, 11, 107, 47);
  static const Color darkThemeColor = Color.fromARGB(255, 27, 31, 139);

  static ThemeData light = ThemeData(
    colorScheme: ColorScheme.fromSeed(seedColor: themeColor, brightness: Brightness.light),
    fontFamily: fontMontserrat,
    cardTheme: CardTheme(
      surfaceTintColor: Colors.white,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
    ),
  );

  static ThemeData dark = ThemeData(
    colorScheme: ColorScheme.fromSeed(seedColor: darkThemeColor, brightness: Brightness.dark),
    fontFamily: fontMontserrat,
    cardTheme: CardTheme(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6))),
  );
}

4. Internationalization

import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:getx_scaffold/getx_scaffold.dart';

class TranslationLibrary extends Translations {
  static const fallbackLocale = Locale('zh', 'CN');
  static const supportedLocales = [Locale('zh', 'CN'), Locale('en', 'US'), Locale('es', 'ES')];

  @override
  Map
> get keys => {
    'zh': zh,
    'en': en,
    'es': es,
  };

  static const localizationsDelegates = [
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate,
    GlobalCupertinoLocalizations.delegate,
  ];
}

Configure the scaffold’s locale , translations , fallbackLocale , supportedLocales , and localizationsDelegates in GetxApp .

5. Add Pages

Pages are built with GetView and GetxController . Controllers mix in BaseControllerMixin for global refresh capabilities.

import 'package:flutter/material.dart';
import 'package:getx_scaffold/getx_scaffold.dart';

class HomePage extends GetView
{
  const HomePage({super.key});

  Widget _buildView() {
    return
[
      ListTile(title: Text(TextKey.zhuTi.tr), onTap: () => Get.to(() => const ThemePage())),
      ListTile(title: Text(TextKey.yuYan.tr), onTap: () => Get.to(() => const LanguagePage())),
    ].toListView(separator: const DividerX()).scrollbar().safeArea();
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder
(
      init: HomeController(),
      id: 'home',
      builder: (_) => DoublePressBackWidget(
        child: Scaffold(
          appBar: AppBar(title: const Text('GetxScaffold'), centerTitle: true, elevation: 1),
          floatingActionButton: _buildFloatingActionButton(),
          body: _buildView(),
        ),
      ),
    );
  }
}

Global Helper Methods

The scaffold provides a set of utility functions such as timestamp retrieval, network status checks, toast messages, loading dialogs, permission requests, and system UI controls. All methods are defined in global_methods.dart and can be called directly.

Extension Methods

Extensions for String? , num? , List , and Widget add convenient helpers like date formatting, number conversion, widget builders (wrap, column, row, listView, etc.), and UI modifiers (visibility, padding, alignment, etc.).

Widgets

GetX Scaffold includes a small set of ready‑made widgets (text styles, buttons, icons, loading spinners, Lottie animations, image loaders, navigation bars) that follow Material 3 design guidelines.

LoadContainer

Provides three built‑in states—loading, empty, error—controlled by LoadController . The UI can switch between these states automatically, and developers can supply custom widgets for each state.

Dialog Utilities

Simple static methods to show confirm, notice, prompt, and menu dialogs via DialogX.to .

Utility Packages

Integrates common_utils and nb_utils features, adding RSA encryption, JWT decoding, money handling, regex validation, timers, and more.

Network Requests

Wraps Dio with HttpService to set a base URL, authorization header, and a global response handler that can intercept errors and display toast messages. Example usage:

HttpService.to.setBaseUrl('https://api.vvhan.com');
HttpService.to.setAuthorization('1234567890');

var response = await HttpService.to.get('/api/wallpaper/acg?type=json');
if (response != null) {
  var result = BaseModel.fromJson(response.data);
  showToast(result.url ?? '');
}

Permission Handling

Encapsulates permission_handler calls. Helper methods like requestCameraPermission() , requestPhotosPermission() , and a generic requestPermission() simplify permission dialogs and result handling.

Overall, GetX Scaffold streamlines Flutter mobile development by offering a ready‑made architecture, UI components, and utility functions that reduce boilerplate and improve consistency across projects.

DartFluttermobile developmentScaffoldGetX
Rare Earth Juejin Tech Community
Written by

Rare Earth Juejin Tech Community

Juejin, a tech community that helps developers grow.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.