liquidsoft_components 0.4.0 copy "liquidsoft_components: ^0.4.0" to clipboard
liquidsoft_components: ^0.4.0 copied to clipboard

outdated

A lightweight but complete flutter component package with Cupertino/Material Widgets, HTTP Caller, Platform Identification, and much more.

example/lib/main.dart

import 'package:example/appMain.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:liquidsoft_components/liquid_components.dart';

void main() {
  bool isDebug = false;
  assert(isDebug = true);

  /// initialize the components, error handling, and httpcaller
  LiquidSoftComponents(
    rootWidget: ExampleApp(),
    httpHeaders: {
      "Access-Control-Allow-Origin": '*',
      "accept": "application/json",
      "content-type": "application/json",
    },
    errorAdminEmail: 'chris@liquidsoft.io',
    isDebug: isDebug,
    logoLocationLight: 'assets/lightLogo.png',
    logoLocationDark: 'assets/darkLogo.png',
  );
}

class ExampleApp extends StatefulWidget {
  @override
  _ExampleAppState createState() => _ExampleAppState();
}

class _ExampleAppState extends State<ExampleApp> {
  /// get the services
  LiquidSoftService _liquidSoftService = LiquidSoftService();

  /// Some of the components will use Theme.of to set the colors based on Brightness.light or dark
  /// Make sure to the theme set or you will get component errors
  final light = ThemeData(
    brightness: Brightness.light,
    primaryColor: HexColor('#FFCD38'),
    primaryColorDark: HexColor('#AE7849'),
    primaryColorLight: Colors.black12,
    accentColor: Colors.black54,
    backgroundColor: HexColor('#fafafa'),
    fontFamily: 'Comfortaa',
  );

  @override
  Widget build(BuildContext context) {
    return _liquidSoftService.getPlatformType == PlatformType.iOS
        ? Theme(
            data: light,
            child: CupertinoApp(
              theme: CupertinoThemeData(
                brightness: Brightness.light,
                primaryColor: Theme.of(context).primaryColor,
                primaryContrastingColor: Theme.of(context).accentColor,
              ),

              /// Make sure to add this key or error handling and any dialog/snackbars will not work
              navigatorKey: _liquidSoftService.getNavigatorKey(),
              home: AppMainScreen(),

              /// The localizations are required for cupertino
              /// the text widgets need a Material ancestor
              localizationsDelegates: [
                GlobalMaterialLocalizations.delegate,
                GlobalWidgetsLocalizations.delegate,
                GlobalCupertinoLocalizations.delegate,
              ],
              supportedLocales: [
                const Locale('en', ''), // English, no country code
              ],
            ),
          )
        : MaterialApp(
            /// Make sure to add this key or error handling and any dialog/snackbars will not work
            navigatorKey: _liquidSoftService.getNavigatorKey(),
            debugShowCheckedModeBanner: false,
            title: "LiquidSoft Component Example App",
            theme: light,
            home: AppMainScreen(),

            /// The localizations are required for cupertino
            /// the text widgets need a Material ancestor
            localizationsDelegates: [
              GlobalMaterialLocalizations.delegate,
              GlobalWidgetsLocalizations.delegate,
              GlobalCupertinoLocalizations.delegate,
            ],
            supportedLocales: [
              const Locale('en', ''), // English, no country code
            ],
          );
  }
}
3
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A lightweight but complete flutter component package with Cupertino/Material Widgets, HTTP Caller, Platform Identification, and much more.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

connectivity, flutter, http, intl, universal_io

More

Packages that depend on liquidsoft_components