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

It is designed to simplify code and support utilities for personal and commercial use

for-GridView

Make a responsive gridview by using both 1 and 2

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

    crossAxisCount: getResCrosCountGrid(
        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: getResGridRatio(
        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: getGridRatio(
        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
    

for-String

  1. Get the MediaQuery

    '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
    

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. Allows you to handle Visibility, Opacity, AbsorbPointer and PhysicalModel

    Text('data').cVisible(true)
    Text('data').cOpacity(0.3)
    Text('data').cAbsorb(true)
    Text('data').cShadow()
    
  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)
    

pub package

Alt

15
likes
0
pub points
63%
popularity

Publisher

verified publisherrepad.dev

It is designed to simplify code and support utilities for personal and commercial use

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_custom_utils