License: MIT Medium: nuhcanatar20

codenoah

The Codenoah package is a comprehensive utility package that provides a set of design components and useful extensions you need when developing applications with Flutter. Codenoah includes a variety of tools and widgets specifically geared towards design and user experience improvement. With this package you can develop your Flutter projects faster and more efficiently, minimizing code repetition and configuration.

View Size extension

 Container(
  width: ViewSizeValueModelExtension(context).maxWidth(context),
  height: ViewSizeValueModelExtension(context).dynamicHeight(context, 0.2),
  color: Colors.red,
),

BorderRadius

Extension to be used for Edge Softening

RadiusExtension // extension

Usage:
  • RadiusExtension.lowRadiusValue // 20.0
  • RadiusExtension.normalRadiusValue // 12.0
  • RadiusExtension.highRadiusValue // 4.0
  • RadiusExtension.circularHighValue // 124
  • RadiusExtension.circularNormalValue // 24
  • RadiusExtension.circularMediumValue // 15
  • RadiusExtension.circularLowValue // 4

Copying

Use for copying text.

 onTap: (){
  CodeNoahClipboard.controlC('CodeNoah Package').then((val) {
      if (!mounted) return;
      CodeNoahDialogs(context).showFlush(
        type: SnackType.success,
        message: 'Copied successfully',
      );
    }).catchError((val) {
      if (!mounted) return;
      CodeNoahDialogs(context).showFlush(
        type: SnackType.error,
        message: 'Failed to copy',
      );
    });
}

Paste

Use for text pasting.

 onTap: () async{
   final String? pastedText = await CodeNoahClipboard.controlV();
    if (pastedText != null) {
      if (kDebugMode) {
        print('Pasted text: $pastedText');
      }
    } else {
      if (kDebugMode) {
        print('Clipboard is empty or contains invalid data.');
      }
    }
}

Routing

// Normal Routing
() {
  CodeNoahNavigatorRouter.push(
    context,
    ViewScreen(),
  );
},

// Screen Routing with Normal Position
() {
  CodeNoahNavigatorRouter.push(
    context,
    ViewScreen(),
    direction: SlideDirection.leftToRight,
  );
},

// Screen Routing with Normal Position without Reversal
() {
  CodeNoahNavigatorRouter.pushAndRemoveUntil(
    context,
    ViewScreen(),
  );
},

// Screen Routing with Normal Position without Reversal
() {
  CodeNoahNavigatorRouter.pushAndRemoveUntil(
    context,
    ViewScreen(),
    direction: SlideDirection.leftToRight,
  );
},

// Switches to the specified route (page).
 CodeNoahNavigatorRouter.pushNamed(
  context,
  '/login',
);

// Removes all previous pages and switches to the specified route.
// Pressing the Back button does not return to previous pages.
CodeNoahNavigatorRouter.pushNamedAndRemoveUntil(
  context,
  '/login',
);

SlideDirection Features:
  • SlideDirection.leftToRight
  • SlideDirection.rightToLeft
  • SlideDirection.topToBottom
  • SlideDirection.bottomToTop

Padding

For interior space uses: PaddingSizedsUtility

Usage:
  • PaddingSizedsUtility.hugePaddingValue // 125.0
  • PaddingSizedsUtility.hightPaddingValue // 55.0
  • PaddingSizedsUtility.normalPaddingValue // 16.0
  • PaddingSizedsUtility.mediumPaddingValue // 10.0
  • PaddingSizedsUtility.smallPaddingValue // 5.0

Margin

For external cavity uses: MarginSizedsUtility

Usage:
  • MarginSizedsUtility.hugeMarginValue // 125.0
  • MarginSizedsUtility.hightMarginValue // 55.0
  • MarginSizedsUtility.normalMarginValue // 16.0
  • MarginSizedsUtility.mediumMarginValue // 10.0
  • MarginSizedsUtility.smallMarginValue // 5.0

Firebase Service

Firebase Servisi Kullanımları : FirebaseService

  Future<void> exampleCollection() async {
    // collection
    final collectRef =
        await FirebaseService().cloudFireStore.collection('User').get();

    // authentication
    final authRef =
        await FirebaseService().authService.createUserWithEmailAndPassword(
              email: 'hello@gmail.com',
              password: "123",
            );

    // auth id
    final userId = FirebaseService().authID;
  }

Exception

For Exception Usage : ServiceException

 
Future<void> hello() async {
  try {
    //
  } catch (e) {
    throw ServiceException('Hello');
  }
}

Validator Usage

Field Validator For Validation : CodeNoahValidator

TextFormField(
  validator: (String? value) =>
      CodeNoahValidator(value: value, context: context).emptyNormalCheck,
),
Usage:
  • CodeNoahValidator(value: value, context: context).emptyNormalCheck
  • CodeNoahValidator(value: value, context: context).emptyNumberCheck
  • CodeNoahValidator(value: value, context: context).emailCheck
  • CodeNoahValidator(value: value, context: context).passwordCheck
  • CustomValidator(value: value, context: context).phoneNumberValidator(value)

Customized Button Usage

CustomButtonWidget(
  width: ViewSizeValueModelExtension(context).maxWidth(context),
  text: 'Hello',
  func: () {},
  btnStatus: ButtonTypes.primaryColorButton,
),
ButtonTypes Usage:
  • ButtonTypes.primaryColorButton
  • ButtonTypes.iconPrimaryColorButton
  • ButtonTypes.borderPrimaryColorButton
  • ButtonTypes.borderErrorColorButton
DropDownSingleListMenuWidget(
  selectStatus: '', // select value
  onStatusChanged: (val) {}, // select change
  text: 'Select', // title
  list: const [ // items
    'Flutter',
    'Kotlin',
    'Node.js',
  ],
  statusValidator: true, // validator control
  languageOptions: LanguageOptions.turkish, // validator error language
  menuIcon: const Icon( // menu ıcon
    Icons.arrow_downward,
  ),
),

Email Field Usage

CustomEmailFieldWidget(
   emailController: emailEditingController, // controller
   hintText: 'E-mail Field', // hint text
   onChanged: (val) {}, // in case of clicks
   isLabelText: true, // header label 
   languageOptions: LanguageOptions.english, // language preference for validator errors
 ),

Password Field Usage

CustomPasswordFieldWidget(
  passwordController: passwordEditingController, // controller
  hintText: 'Password Field', // hint text
  onChanged: (val) {}, // in case of clicks
  isValidator: true, // validator error status
  isLabelText: true, // header label
  width: ViewSizeValueModelExtension(context).maxWidth(context), // label text width
  languageOptions: LanguageOptions.english, // language preference for validator errors
),

Normal Text Field

NormalTextFieldWidget(
  controller: normalEditingController, // controller
  hintText: 'Normal Text Field', // hint text
  explanationStatus: false, // explanation field status
  onChanged: (val) {}, // in case of clicks
  isValidator: true, // validator error status
  enabled: true, // field enabled active status
  isLabelText: true, // header text
  languageOptions: LanguageOptions.english, // language prefrence for validator errors
),

Number Field

NumberTextFieldWidget(
  controller: numberEditingController, // controller
  hintText: 'Number Field', // hint text
  onChanged: (val) {}, // in case of clicks
  isLabelText: true, // header text
  languageOptions: LanguageOptions.english, // language prefrence for validator errors
),

Phone Number Field

PhoneNumberFieldWidget(
  phoneNumberController: phoneNumberEditingController, // controller
  hintText: 'Phone Number Field', // hint text
  onChanged: (val) {}, // in case of clicks
  isLabelText: true, // header text
  width: ViewSizeValueModelExtension(context).maxWidth(context), // label text width
  languageOptions: LanguageOptions.english, // language preference for validator errors
),

Show Flush Usage

void showFlush() {
  CodeNoahDialogs(context).showFlush(
    type: SnackType.success,
    message: 'Test Show Flush Message',
  );
}
void modalBottom() {
  CodeNoahDialogs(context).showModalBottom(
    SizedBox(
      width: ViewSizeValueModelExtension(context).maxWidth(context),
      height: ViewSizeValueModelExtension(context).dynamicHeight(
        context,
        0.2,
      ),
      child: const Center(
        child: TitleLargeBlackBoldText(
          text: 'text',
          textAlign: TextAlign.center,
        ),
      ),
    ),
    backgroundColor: Colors.white,
  );
}

Loading Dialog Usage

void loadingDialog() {
  CodeNoahDialogs(context).showAlert(
    const BodyMediumWhiteText(
      text: 'Loading...',
      textAlign: TextAlign.center,
    ),
  );
}

Asset Image Usage

CodeNoahImageAsset(
  toImg: 'assets/images/exampleimg.png',
  width: 122,
  height: 122,
),

SVG Image Usage

CodeNoahImageSvg(
  toImg: 'assets/images/example.svg',
  width: 122,
  height: 122,
),

Color Extension

Container(
  width: 55,
  height: 55,
  color: ColorExtension.lightGreen,
),

Width and Height Extension

SizedBox(
  width: ViewSizeValueModelExtension(context).maxWidth(context),
  height: WidthHeightExtension.normalHeight,
),
Usage:
  • WidthHeightExtension.normalHeight // 0.10
  • WidthHeightExtension.standartHeight // 0.06
  • WidthHeightExtension.mediumHeight // 0.08
  • WidthHeightExtension.largeHeight // 0.15

License

License

2025 created for @NuhcanATAR



Libraries

codenoah