kartal 2.1.0
kartal: ^2.1.0 copied to clipboard

Kartal is an extension package for easy to use at app development time. You can access more features with primitive variables(context, string etc.).

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}'),
    );
  }

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),
    );

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'),
        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);
  }

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

47
likes
100
pub points
82%
popularity

Publisher

vb10.dev

Kartal is an extension package for easy to use at app development time. You can access more features with primitive variables(context, string etc.).

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

device_info, flutter, mask_text_input_formatter, package_info, pedantic, share, url_launcher

More

Packages that depend on kartal