App5 : Yacht Charter - Learning New Widgets



  1. Stack
  2. A widget that positions its children relative to the edges of its box.
    This class is useful if you want to overlap several children in a simple way, for example having some text and an image, overlaid with a gradient and a button attached to the bottom.

    Some properties of Stack Class:

    1. children : List<Widget>
    2. The widgets below this widget in the tree.

    3. alignment : AlignmentGeometry
    4. How to align the non-positioned and partially-positioned children in the stack.

    5. fit : StackFit
    6. How to size the non-positioned children in the stack.

    Example :


            Stack(

              fitStackFit.expand,

              children: [

                Image.network(

                  "https://www.ideasdonuts.com/wp-content/uploads/2021/06/Cute-and-Pleasing-HD-Phone-Background-18.jpg",

                  fitBoxFit.cover,

                ),

                Center(

                  childText(

                    "Color The World!",

                    styleTextStyle(

                        colorColors.cyanAccent,

                        fontSize35,

                        fontWeightFontWeight.bold),

                  ),

                )

              ],

            )


    Stack example

  3. DropdownButton
  4. A material design button for selecting from a list of items.
    A dropdown button lets the user select from a number of items. The button shows the currently selected item as well as an arrow that opens a menu for selecting another item.

    Some properties of DropdownButton Class:

    1. disabledHint : Widget
    2. A preferred placeholder widget that is displayed when the dropdown is disabled.

    3. dropdownColor : Color
    4. The background color of the dropdown.

    5. hint : Widget
    6. A placeholder widget that is displayed by the dropdown button.

    7. icon : Widget
    8. The widget to use for the drop-down button's icon.

    9. items : List<DropdownMenuItem<T>>
    10. The list of items the user can select.

    11. itemHeight : Double
    12. If null, then the menu item heights will vary according to each menu item's intrinsic height.

    13. onChanged :
    14. Called when the user selects an item.

    15. style : TextStyle
    16. The text style to use for text in the dropdown button and the dropdown menu that appears when you tap the button.

    17. underline : Widget
    18. The widget to use for drawing the drop-down button's underline.

    19. value :
    20. The value of the currently selected DropdownMenuItem.

    Example :


    DropdownButton<String>(

              value_choice,

              underlineContainer(

                height2,

                colorColors.grey,

              ),

              onChanged: (StringnewValue) {

                setState(() {

                  _choice = newValue!;

                });

              },

              styleTextStyle(colorColors.blueGreyfontSize25),

              iconIcon(Icons.arrow_back),

              dropdownColorColors.yellowAccent,

              itemHeight75,

              items: ['Choice 1''Choice 2''Choice 3''Choice 4''Choice 5']

                  .map((value) {

                return DropdownMenuItem(

                  valuevalue,

                  childText(

                    value,

                  ),

                );

              }).toList(),

            )


    DropdownButton flutter

    DropdownButton flutter

  5. Slider
  6. Used to select from a range of values.

    Some properties of Slider Class:

    1. activeColor : Color
    2. The color to use for the portion of the slider track that is active.

    3. divisions : int
    4. The number of discrete divisions.

    5. inactiveColor : Color
    6. The color for the inactive portion of the slider track.

    7. label : String
    8. A label to show above the slider when the slider is active.

    9. max : double
    10. The maximum value the user can select.

    11. min : double
    12. The minimum value the user can select.

    13. onChanged :
    14. Called during a drag when the user is selecting a new value for the slider by dragging.

    15. value : double
    16. The currently selected value for this slider.

    Example :


           Slider(

              value_value,

              min1,

              max5,

              divisions4,

              label"value : $_value",

              onChanged: (val) {

                setState(() {

                  _value = val;

                });

              },

              activeColorColors.red,

              inactiveColorColors.green,

            )



    Slider Flutter

  7. CheckBox
  8. A checkbox is a type of input component which holds the Boolean value. It is a GUI element that allows the user to choose multiple options from several selections.

    Some properties of CheckBox Class:

    1. activeColor : Color
    2. The color to use when this checkbox is checked.

    3. checkColor : Color
    4. The color to use for the check icon when this checkbox is checked.

    5. onChanged :
    6. Called when the value of the checkbox should change.

    7. value : bool
    8. The currently selected value for this slider.

    Example :


            Checkbox(

              value_value,

              onChanged: (val) {

                setState(() {

                  _value = val;

                });

              },

              activeColorColors.pink,

              checkColorColors.white,

            )



    checkbox flutter

    checkbox flutter

  9. Positioned
  10. A widget that controls where a child of a Stack is positioned.
    A Positioned widget must be a descendant of a Stack, and the path from the Positioned widget to its enclosing Stack must contain only StatelessWidgets or StatefulWidgets.

    Some properties of Positioned Class:

    1. child : Widget
    2. The widget below this widget in the tree.

    3. width : double
    4. The child's width.

    5. height : double
    6. The child's height.

    7. bottom : double
    8. The distance that the child's bottom edge is inset from the bottom of the stack.

    9. left : double
    10. The distance that the child's left edge is inset from the left of the stack.

    11. right : double
    12. The distance that the child's right edge is inset from the right of the stack.

    13. top : double
    14. The distance that the child's top edge is inset from the top of the stack.

    Example :


            Stack(

              children: [

                Positioned(

                    width50,

                    height100,

                    top140,

                    left60,

                    childContainer(

                      colorColors.pink,

                      childIcon(

                        Icons.bluetooth,

                        colorColors.white,

                        size50,

                      ),

                    ))

              ],

            )



    flutter positioned