A flutter package from AsurRaa for widgets and utility functions to support mobile departments here.

Overview

sura_flutter

pub package Latest commit

A flutter package from AsurRaa for custom widgets and utility functions.

Migrate from 0.2.x to 0.3.x

  • BREAKING CHANGE:

    • remove FutureManager, AsyncSubjectManager, FutureManagerBuilder
    • All manager class now has a separate package
    dependencies:
      sura_manager: 0.1.2

Installation

Add this to pubspec.yaml

dependencies:
  sura_flutter: ^0.5.1

Widgets

Widget Description
SuraRaisedButton Custom ElevatedButton with loading notifier
SuraBadge Small badge like notification
SuraActionSheet Custom CupertinoActionSheet for option selector
ConditionalWidget Build a widget base on a boolean condition
SuraToolbar Custom ToolBar or AppBar
SuraFutureHandler FutureBuilder with less boilerplate code
SuraAccordian Custom ExpansionTile
SuraExpandable Similar to SuraAccordion but with different use case
SuraConfirmationDialog Platform adaptive AlertDialog with cancel and confirm action
SuraAsyncButton Fully customize Material ElevatedButton for asynchronus onPressed callback
SuraLoadingDialog Create and manage Loading Dialog
SuraPlatformChecker Platform adaptive widget
SuraSimpleDialog Simple platform adaptive AlertDialog
SuraListTile Custom ListTile
SuraPaginatedList ListView with pagination support
SuraPaginatedGridBuilder Gridview with pagination support
SuraIconButton Custom IconButton
SuraFlatButton Cusztom TextButton or FlatButton
SpaceX SizedBox with only width
SpaceY SizedBox with only height
SuraStreamHandler A Streambuilder with less boilerplate code
SuraNotifier A ValueListenableBuilder with less boilerplate code

Mixin

AfterBuildMixin

Create an override method that will call after the build method has been called

class _HomePageState extends State<NewPage> with AfterBuildMixin {

  //this method will call after widget has been build
  @override
  void afterBuild(BuildContext context) {

  }

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}

SuraFormMixin

Provide some property and method when working with Form

field and attribute

  • formKey: a key for form
  • loadingNotifier: a bool ValueNotifier
  • passwordObsecureNotifier: a bool ValueNotitifer for toggling password obsecure field
  • isFormValidated: a bool return by validate formKey

method

  • toggleLoading: toggle loadingNotifier
  • togglePasswordObsecure: toggle passwordObsecureNotifier
class _HomePageState extends State<NewPage> with SuraFormMixin {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Form(key: formKey, child: child)
    );
  }
}

BoolNotifierMixin

Provider a ValueNotifier and a value toggle function

  • boolNotifier: a bool ValueNotifier

method

  • toggleValue: toggle loadingNotifier
class _HomePageState extends State<NewPage> with BoolNotifierMixin {
  @override
  Widget build(BuildContext context) {
    return Container();
  }
}

Widget's Extension

padding, margin

Text("Hello Flutter").padding(EdgeInsets.all(16.0)) // defaulat value is EdgeInsets.all(8.0)
Text("Hello Flutter").margin(EdgeInsets.all(16.0)) // defaulat value is EdgeInsets.all(8.0)
///As a value
Text("Hello Flutter").marginValue(all: 12)
Text("Hello Flutter").paddingValue(horizontal: 12, vertical: 8)

cssSpacing

Text("Hello Flutter").cssSpacing(margin: [10,10], padding:[16])
//css margin and padding rule

rotate (in degree)

Text("Hello Flutter").rotate(45)

flexible, expanded, clipOval, opacity

Text("Hello Flutter").flexible
Text("Hello Flutter").expanded
Text("Hello Flutter").clipOval
Text("Hello Flutter").opacity(0.5)

TextStyle Extention

Text("Hello Flutter", style: TextStyle().normal)
Text("Hello Flutter", style: TextStyle().medium)
Text("Hello Flutter", style: TextStyle().bold)
Text("Hello Flutter", style: TextStyle().applyColor(Colors.white))
Text("Hello Flutter", style: TextStyle().applFontSize(24))

Other Extension

BuildContext extension

  Size screenSize = context.screenSize;
  Color primaryColor = context.primaryColor;
  Color accentColor = context.accentColor;
  TextTheme textTheme = context.textTheme;
  Theme theme = context.theme;

DateTime extension

DateTime.now().format(format: "dd mmm yyyy", locale: context.locale)
DateTime.now().isTheSameDay(DateTime.now())
DateTime.now().formatToLocalDate(format: "dd mmm yyyy", locale: context.locale)

String extension

String name = "chunlee".capitalize() // => Chunlee

Utility and Style

DotTabIndicator

alt text

  TabBar(
      ...
      indicator: DotTabIndicator(
        color: Colors.blue,
        dotAlignment: TabAlignment.bottom,
      )
      ...
  )

SmallUnderlineTabIndicator

alt text

  TabBar(
      ...
      isScrollable: true, //This indicator work best with scrollable tab bar
      indicator: SmallUnderlineTabIndicator(
        color: Colors.blue,
        paddingLeft: 16,
        alignment: TabAlignment.bottom,
      )
      ...
  )

ShadowInputBorder

This input border solve a problem thath TextField doesn't have a default elevation.

alt text

  TextFormField(
      ...
      decoration: InputDecoration(
        border: ShadowInputBorder(
          elevation: 2.0, //required
          fillColor: Colors.white, //required
          borderRadius: SrauStyle.radius(),
          shadowColor: Colors.black87,
        ),

      )
      ...
  )

SuraColor

//Get Color from hex string
Color green = SuraColor.fromCode("42f545")

//Get Color from RGB without Alpha or Opacity
Color newColor = SuraColor.fromRGB(8, 182, 155)

//Convert color to MaterialColor
MaterilColor newMaterialColor = SuraColor.toMaterial(0xFF869CF4)

SuraUtils

//Get byte from asset bundle
Future<Uint8List> imageByte = await SuraUtils.getBytesFromAsset("image asset path", 200); //200 is imagewidth

//Get random image from unsplash
String carUrlImage =  SuraUtils.unsplashImage(width: 200, height: 200, category: "car");

//Get random from picsum with provided: width and height
String randomUrlImage = SuraUtils.picsumImage(200,300);

SuraFormValidator

Provide some field validation

TextFormField(
validator: (value) => SuraFormValidator.validateField(value, field:"username"),
)

SuraPageNavigator and SuraNavigator

PageNavigator support push, pushReplacement and pushAndRemove method

SuraPageNavigator.push(context, DetailPage());
SuraPageNavigator.pushReplacement(context, HomePage());
SuraPageNavigator.pushAndRemove(context, RootPage());

SuraNavigator also support push, pushReplacement, pushAndRemove without providing a context but you need to add SuraNavigator.navigatorKey to MaterialApp

MaterialApp(
    ...
    navigatorKey: SuraNavigator.navigatorKey,
    ...
    home: MyHomePage(),
)
SuraNavigator.push(DetailPage());
SuraNavigator.pushReplacement(HomePage());
SuraNavigator.pushAndRemove(RootPage());

SuraNavigator also can show dialog without providing a context

var result = await SuraNavigator.dialog(MyDialog());

SuraDecoration

RoundedRectangleBorder roundRectangle = SuraDecoration.roundRect(12);//default value is 8
BorderRadius radius = SuraDecoration.radius(12); //default value is 8
You might also like...

Here is an application project that displays a list of products from the Elevenia API called STORE.

Here is an application project that displays a list of products from the Elevenia API called STORE.

Here is an application project that displays a list of products from the Elevenia API called STORE.

May 18, 2022

This project is a rebuild of the existing movie colony https://github.com/debbsefe/Movie-Colony. Here's also a link to the figma file https://www.figma.com/file/XpLFNEsROiN1z6lwnNHMrU/Movie-app?node-id=2956%3A10161

Tvfiy Generated by the Very Good CLI πŸ€– A Very Good Project created by Very Good CLI. Getting Started πŸš€ This project contains 3 flavors: development

Nov 12, 2022

A Dart package that constantly writes a string to an IOSink, simillarly to the UNIX yes utility.

yes A Dart package that constantly writes a string to an IOSink, simillarly to the UNIX yes utility. Usage // Write to stdout for 5 seconds. final con

Sep 22, 2022

A Dart utility package for easy async task cancellation

Dart Cancellation Token. Inspired by CancellationToken in C#. A Dart utility package for easy async task cancellation.

Sep 6, 2022

Flutter plugin, support android/ios.Support crop, flip, rotate, color martix, mix image, add text. merge multi images.

Flutter plugin, support android/ios.Support crop, flip, rotate, color martix, mix image, add text. merge multi images.

image_editor The version of readme pub and github may be inconsistent, please refer to github. Use native(objc,kotlin) code to handle image data, it i

Jan 3, 2023

Awesome Flutter Snippets is a collection snippets and shortcuts for commonly used Flutter functions and classes

Awesome Flutter Snippets Awesome Flutter Snippets is a collection of commonly used Flutter classes and methods. It increases your speed of development

Dec 9, 2022

flutter chat app with firebase , provider and api with all chat app functions

flutter chat app with firebase , provider and api with all chat app functions

Full Chat Flutter App In this app we use FireBase Services(firestore - storage - auth - cloud messageing ) Dio for api setiing such as sending remote

Dec 14, 2022

Calculator provides simple and advanced mathematical functions in a beautifully designed app.

Calculator provides simple and advanced mathematical functions in a beautifully designed app.

Hi there, I'm Behruz Hurramov Getting Started $ git clone https://github.com/ariscybertech/aris_calculator.git $ flutter packages get Run the applicat

Jul 7, 2022

Calculator provides simple and advanced mathematical functions in a beautifully designed app.

Calculator provides simple and advanced mathematical functions in a beautifully designed app.

Adv Calculator See LICENSE A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get y

Feb 21, 2022
Owner
AsurRaa
Doing great stuff.
AsurRaa
A package that exports functions for converting, formatting, and nicening of dates/times in Dart.

Instant A library for manipulating and formatting DateTimes in Dart. Dates and times have never been easier. | DateTime timezone manipulation | Easy f

Aditya Kishore 10 Jan 22, 2022
All of my open source flutter and dart projects, tutorials are published here.

Flutter In this repository I publish all of my open source flutter, dart projects, and tutorials. Written Tutorials Dart Programming Language for Prog

Mahmud Ahsan 143 Jan 1, 2023
Place picker for Flutter using open street, Here maps and google map

Flutter Place Picker A Flutter plugin which provides 'Picking Place' using Open Street, Here Maps and Google Maps widget. Much thanks to Terry Kwon Th

Samuel Annin Yeboah 15 Oct 27, 2022
Screenshots - A command line utility and package for capturing screenshots for Flutter

A screenshot image with overlaid status bar placed in a device frame. For an example of images generated with Screenshots on a live app in both stores

Maurice McCabe 258 Nov 22, 2022
A dart package which provides a lot of helpers functions for easy development.

more_functions A dart package which provides a lot of helpers functions for easy development. Installation Add this to your packages pubspec.yaml file

Talat El Beick 0 Dec 5, 2021
Dart package responsible to provide the basic resources to Lambda Functions with Clean Dart

AWS Lambda Core This package is responsible to provide the basic resources to all services; Usage pubspec.yaml dependencies: aws_lambda_core: <laste

David Araujo 1 Dec 2, 2021
continue to my flutter journey here's the comeback repo , lets see what i will end up making

flutter_application_1 A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you st

Nerajan kc 3 May 19, 2021
Here’s a Tinder Gold redesign concept for the popular dating app made with Flutter.

Tinder Gold redesign concept for the popular dating app made with Flutter, Hosted on Codemagic. Don't forget to star ⭐ the repo it motivates me to sha

Sanskar Tiwari 197 Jan 2, 2023
Just usual flutter stuff nothing to see here.

Fleetime ??‍♂️ βŒ› Fleetime merupakan aplikasi untuk melihat film - film yang sedang populer atau biasanya disebut Movie App, aplikasi ini dilombakan un

fleetime 5 Dec 22, 2022