1. Flutter Enum

    What is enum ?

    • Enum in dart is enumerated, iterable
    • Enum is used for defining named constant values.

    How to use ?

    • Synstax
    enum PlatformEnum {
        android, ios, windown
    }
    
    • Iterate over enum values
    PlatformEnum.values.forEach((value) => print('value: $value, index: ${value.index}'));
    
    • Extension enum
    extension PlatformEnumExtension on PlatformEnum {
        String? get title {
            switch …
    read more

    There are comments.

  2. Flutter Buttons

    ElevatedButton

    ElevatedButton(
      onPressed: () {},
      child: Text('Button'),
      style: ElevatedButton.styleFrom(shape: StadiumBorder()),
    )
    
    shape types: RoundedRectangleBorder / StadiumBorder / CircleBorder / BeveledRectangleBorder
    

    OutlinedButton

    OutlinedButton(
        onPressed: () {},
        child: Text('Button'),
        style: OutlinedButton.styleFrom(
            shape: StadiumBorder(),
        ),
    )
    

    TextButton:

    • You can always use TextButton if you don't want an outline or color fill.
    • Don't forget, there's also an .icon constructor …
    read more

    There are comments.

« Page 2 / 2

Links

Social