Git Product home page Git Product logo

kartal's Introduction

kartal

kartal

Kartal is the place for my borning country so I created an extension for giving born to more power with simple use. If you want to example with these extensions, you should be look example folder.


Future Extension

You can easy use for network or any future request.

  Future<String> fetchDummyData(BuildContext context) async {
    await Future.delayed(context.durationLow);
    return Future.value('Okey');
  }

  @override
  Widget build(BuildContext context) {
    return fetchDummyData(context).toBuild<String>(
        onSuccess: (data) {
          return Text(data);
        },
        loaindgWidget: CircularProgressIndicator(),
        notFoundWidget: Text('Oh no'),
        onError: FlutterLogo());
  }

Context Extension


You can easy to use context power so context help for many needs.

General Context Extension

I use the most this extesnion. It's most needed for the your products.

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(brightness: context.appBrightness),
      body: Container(
        height: context.mediaQuery.size.height,
        color: context.colorScheme.onBackground,
        child: Text(context.isKeyBoardOpen ? 'Open' : 'Close', style: context.textTheme.subtitle1),
      ),
    );
  }

Widget Extension

Sometimes need visible widget so you can this extension.

Text("Hello").toVisible(isAvaible);

MediaQuery Extension

These extension gives device size use so you can need dynamic(grid) value for device aspect, use the dyanmic height or width.

  SizedBox(
      height: context.dynamicHeight(0.1),
      width: context.dynamicWidth(0.1),
      child: Text('${context.lowValue}'),
    );
  }

Navigation Extension

These directly access navigation features.

   Column(
        children: [
          FloatingActionButton(
            child: Text('Navigation Prop'),
            onPressed: () {
              context.navigation.canPop();
            },
          ),
          FloatingActionButton(
            onPressed: () {
              context.pop();
            },
            child: Text('Navigation Pop'),
          ),
          FloatingActionButton(
            onPressed: () {
              context.navigateName('/hello');
            },
            child: Text('Navigation Named'),
          ),
           FloatingActionButton(
            onPressed: () {
              context.navigateToPage(HomeViewDetail(), type: SlideType.TOP);
            },
            child: Text('Navigation Named'),
          ),
          FloatingActionButton(
            onPressed: () {
              context.navigateToReset('/hello');
            },
            child: Text('Navigation Named and Remove'),
          ),
        ],
      )

Duration Extension

These extensions mainly for animation use.

AnimatedOpacity(
      opacity: context.isKeyBoardOpen ? 1 : 0,
      duration: context.durationLow,
      child: Text('${context.durationLow.inHours}'),
    );

Padding Extension

These extensions declare project main padding values.

Padding(
      padding: context.paddingLow,
      child: Padding(
        padding: context.horizontalPaddingMedium,
        child: Text('${context.durationLow.inHours}'),
      ),
    )

Empty Widget Extension

Sometimes need empty widget screen for space area, you can use that time.

Column(
      children: [
        Text('${context.durationLow.inHours}'),
        context.emptySizedHeightBoxHigh,
        Row(
          children: [Text('Row'), context.emptySizedWidthBoxLow, Text('Row')],
        )
      ],
    )

Radius Extension

This extension only uses to draw the border.

  Container(
      decoration: BoxDecoration(borderRadius: context.lowBorderRadius),
    );

Device Screen Size Extension

This extension is used to create responsive widgets.

  Scaffold(
      drawer: context.isSmallScreen ? Drawer() : null,
      body: Container(),
    );

Device Operatig System Extension

This extension is used to create native widgets.

  SizedBox(
      child: context.isIOSDevice ? CupertinoButton() : MaterialButton(),
    );

Image Extension 🌠


You can use very easy rotiaton from image.

  @override
  Widget build(BuildContext context) {
    return Image.network('https://picsum.photos/200/300').bottomRotation;
  }

Intager Extensıon


Now, we has a a little code.

extension IntagerExtension on int {
  int get randomValue => Random().nextInt(17);
}

List Extension

We need list operation sometmes null check etc.

List Validation Extension

We can check this for empty and null.

   final List values = null;
  @override
  Widget build(BuildContext context) {
    return Container(
      child: values.isNotNullOrEmpty ? Text('ok') : Text('false'),
    );
  }

String Extension


String need validation, color, launch, share etc.

Package Information Extension

You can access directly applicaton platform information.

 Text(''.appName)
 Text(''.version)
 Text(''.packageName)
 Text(''.buildNumber)

Validation Extension

Validate your string value to some features.

 TextFormField(validator: (value) => value.isNotNullOrNoEmpty ? null : 'fail'),

Input Formatter

You need the value mask and validation use formatter extension.

Column(
      children: [
        TextFormField(validator: (value) => value.isNotNullOrNoEmpty ? null : 'fail'),
        TextFormField(validator: (value) => value.isValidEmail ? null : 'fail'),
        TextFormField(validator: (value) => value.isValidPassword ? null : 'fail'),

        TextField(
          inputFormatters: [InputFormatter.instance.phoneFormatter],
          onChanged: (value) {
            print('${value.phoneFormatValue}');
          },
        )
      ],
    );

Launch Any Content In App Dialog Extension

You need open the value in device system. You can just say string value to launch prefix.

 void openEmail(String value){
    value.launchWebsite;
 }

Share Any Content External Apps Extension

These extension share your value to other apps or optional apps.

  void shareWhatssApp(String value) {
    value.shareWhatsApp();
  }

  void openWeb(String value) {
    value.launchWebsite;
  }

Authorization Extension

Sometimes need this extension from send service request so easy create bearer token string.

  void bearerTokenHeader() {
    print('TOKEN-X-X-X'.beraer);
  }

File Extension


There are extensions that will facilitate your file operations.

File Type Extension

This extension shows what type a file is.

  final file = File('assets/image.png');
  Container(
    child: file.fileType == FileType.IMAGE ? Image.asset('${file.path}') : SizedBox();
  );

There is also the use of .is type.

  final file = File('assets/image.jpeg');
  Container(
    child: file.isImageFile ? Image.asset('${file.path}') : SizedBox();
  );

Tasks


  • Advance String Extension
  • More Integer Extension
  • Unit Test
  • File Extension
  • SQLite etc. extension
  • Application Extensions

License

License

2020 created for @VB10

Youtube Channel

Youtube

kartal's People

Contributors

vb10 avatar desxz avatar ebrarbilgili avatar krdnzbyza avatar oguzhansevim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.