Skip to content
Snippets Groups Projects
Select Git revision
  • 056102ca753b3e26a46a712a8054309f524cd68f
  • dev default protected
  • integrating-verify-otp-screen
  • language-selection
  • ECAP1-24-verify_otp
5 results

button_widget.dart

Blame
  • button_widget.dart 3.78 KiB
    /* Created by Nitesh Kumar Verma on 15/12/23 */
    
    import 'dart:developer';
    
    import 'package:exide_crr/res/app_color_text_size.dart';
    import 'package:exide_crr/utils/helper_class.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter_screenutil/flutter_screenutil.dart';
    import 'package:google_fonts/google_fonts.dart';
    import 'package:exide_crr/constants/font_constants.dart';
    
    class CustomButton extends StatelessWidget {
      /// Button name title
      final String buttonName;
    
      /// The callback called when the onTap button clicked
      final VoidCallback onTap;
    
      double height;
      double width;
    
      /// top margin
      double topMargin = 24;
    
      /// bottom margin
      double bottomMargin = 30;
    
      double borderRadius = 16;
    
      Color? backgroundColor;
      Color? activeBackgroundColor;
      Color? foregroundColor;
      Color borderColor = AppColor.transparent;
    
      bool isLoading = false;
      bool isActive = false;
      bool showSuffixIcon = false;
    
      CustomButton({
        Key? key,
        required this.buttonName,
        required this.onTap,
        this.topMargin = 24,
        this.height = 55,
        this.width = 350,
        this.bottomMargin = 30,
        this.borderRadius = 8,
        this.isLoading = false,
        this.isActive = false,
        this.showSuffixIcon = false,
        this.backgroundColor = AppColor.blackColor,
        this.activeBackgroundColor = AppColor.blackColor,
        this.foregroundColor = AppColor.whiteColor,
        this.borderColor = AppColor.transparent,
      }) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        log("${isLoading || !isActive}");
        return Align(
          alignment: Alignment.center,
          child: IgnorePointer(
            ignoring: isLoading || !isActive,
            child: InkWell(
              /// button click event
              onTap: onTap,
              child: Container(
                width: width,
                height: height,
                padding: EdgeInsets.symmetric(vertical: 0.h, horizontal: 24.w),