flutter_custom_utils 0.4.15 copy "flutter_custom_utils: ^0.4.15" to clipboard
flutter_custom_utils: ^0.4.15 copied to clipboard

Streamline your code and enhance personal utility with this meticulously crafted Flutter package, tailored to simplify your development tasks. and commercial use


pub package


utilities

  1. Pick file and crop without loosing quality

    cPickAndCropImage(
        context,
        cropDisable: false,
        aspectRatio: 1.7,
        cancelButton: () {
            setState(() {
                croppedImg = null;
            });
            Navigator.of(context).pop();
        },
        okButton: (Uint8List data, String fileName) {
            /// selected file name
            debugPrint(fileName);
            setState(() {
                croppedImg = data;
                /// Load image to ui using 'Image.memory(croppedImg)'
            });
            Navigator.of(context).pop();
        },
    ),
    
  2. get device id in all available devices platform (android, ios, windows, linux, mac, web(get info details))

     await cGetDeviceId()
    
  3. Widget to png

     cTakePicture(GlobalKey);
     // wrap with RepaintBoundary then use key to create image
     RepaintBoundary(
         key: GlobalKey,
         child:Text('data'),
     )
    
  4. flutter platform

    just call these functions anywhere

     cIsAndroid
     cIsIOS
     cIsLinux
     cIsWindows
     cIsMacOS
     cIsWeb
     cIsFuchsia
    
  5. flutter url structure

    https://repad.dev/splash remove hash from url (https://repad.dev/#/splash)

    void main(){
        // Here we set the URL strategy for our web app.
        cSetPathUrl();
        runApp(MyApp());
    }
    

for-GridView

Make a responsive gridView by using both 1 and 2

provide discardSize to minus size from calculation

  1. Based on your static design's width, calculate the responsive grid item count.

    crossAxisCount: cGetResCrossCountGrid(
        context: context,
        width: 180,
    ),
    
  2. For responsive grid item aspect ratio, it should be derived from your static design based on height and width.

    childAspectRatio: cGetResGridRatio(
        context: context,
        height: 165,
        width: 180,
    ),
    
  3. For normal grid aspect ratio > Having this aspect ratio will never break in larger or smaller devices

    crossAxisCount: 2,
    childAspectRatio: cGetGridRatio(
        crossAxisCount: 2,
        context: context,
        height: 165,
        width: 180,
    ),
    

    Your provided height and width determine how it works


for-GridView

    cFormUrlEncode({'':''});

for-duration, delay

  1. For duration and delay

        void splash() {
            // cDays, cHours, cMinutes, cSeconds, cMilliseconds
            2.cSeconds.cDelay(() {
                // code here
            });
    
            // given number in seconds
            3.cDelay(() {
                // code here
            });
        }
    

for-date time

  1. add TimeOfDay to DateTime
       DateTime.now().cApplied(TimeOfDay.now())
    

for-MediaQuery

  1. Get the MediaQuery

    context.cIsTablet
    context.cSize    // getSize(context)
    context.cMQuery  // mQuery(context)
    context.cWidth
    context.cHeight
    context.cTheme
    context.cIsDarkMode
    context.cIconColor
    context.cTextTheme
    context.cOrient   // orientation
    context.cIsLand   // landscape
    context.cIsPort   // portrait
    context.cDevicePixelRatio
    

more-Utils

  1. utils

    'text'.cToCapitalized
    'text'.cToTitleCase
    'text'.cIsLowerCase
    'text'.cIsAllCap
    'text'.cReverse
    'text'.cIsDigit
    'text'.cIsEmail
    'text'.cIsAlphabetOnly
    'text'.cIsPhoneIND
    'text'.cIsURL
    'text'.cIsPhoneNumber
    'true'.cToBoolean  // 0,1 also available
    '1000'.cToCurrencyIND // ₹ 1,000.00
    '1000'.cToCurrency() // ₹ 1,000
     000.0.cToDistance  // (00 km, 00 m available)
     000.0.cToWeight  // (00 g, 00 kg available)
    
  2. cGetOffer()

     String offer = cGetOffer(offerPrice: 90,ordinalPrice: 100); // 10 %
    
  3. buildString()

     final word = cBuildString((sb) {
         for (var i = 0; i < 10; i++) {
             sb.write(i);
         }
     });  // 0123456789
    

for-list

  1. Get Random item from list

    ['aa', 'bb', 'cc', 'dd'].cRandomSelect.toString()
    
  2. Get first item from list (if list is empty then result will be null)

    ['aa', 'bb', 'cc', 'dd'].cFirst
    ['aa', 'bb', 'cc', 'dd'].cFirstWhere((e)=>(type your condition here)))
    

for-color

  1. Get color from hash code

    CHColor.fromHex('#fffff')
    
  2. Get hash code from color

    Color.fromRGBO(250, 250, 250, 0.1).toHex()
    

for-widget

  1. Allows you to handle (padding/margin)

    Text('data').cPadZero // cMargZero
    Text('data').cPadAll(10) // cMargAll
    Text('data').cPadOnly(l: 10, r: 10, t: 10, b: 10,) // cMargOnly
    Text('data').cPadSymmetric(h: 10, v: 10,), // cMargSymmetric
    
  2. Allows you to handle ClipRRect

    Container().cClipAll(10)
    Container().cClipHorizontal(l:10, r:10,)
    Container().cClipVertical(t:10, b:10,)
    Container().cClipOnly(tl: 10, tr: 10, bl: 10, br: 10,)
    
  3. Allows you to insert widgets inside a CustomScrollView

    Text('data').cToSliver
    
  4. More widgets

    Text('data').cVisible(true)
    Text('data').cOpacity(0.3)
    Text('data').cAbsorb(true)
    Text('data').cShadow()
    Text('data').cHero(tag)
    Text('data').cSizedBox(h:10,w:10)
    
  5. Allows you to handle Alignment

    Text('data').cAlignment(Alignment.topCenter)
    Text('data').cPosition(l: 10, r: 10, t: 10, b: 10,)
    Text('data').cToCenter
    Text('data').cExpand(2)
    
  6. For PreferredSize

    Text('data').cPreferSize(20)
    Text('data').cAspectRatio(1.2)
    

Alt

15
likes
0
pub points
63%
popularity

Publisher

verified publisherrepad.dev

Streamline your code and enhance personal utility with this meticulously crafted Flutter package, tailored to simplify your development tasks. and commercial use

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

crop_image, device_info_plus, file_picker, flutter, flutter_web_plugins, intl

More

Packages that depend on flutter_custom_utils