Showing posts with label android snack bar. Show all posts
Showing posts with label android snack bar. Show all posts

The SnackBar

 Code for the snack bar when the elevated button is clicked.


            ElevatedButton(
              onPressed: () {
                // define snackBar
                SnackBar snackBar = SnackBar(
                  content: const Text(
                    "This is a snack bar",
                    style: TextStyle(color: Colors.white),
                  ),
                  backgroundColor: Colors.green,
                  action: SnackBarAction(
                      label: "UNDO",
                      onPressed: () {
                        print("YOu clicked the UNDO action button!");
                      }),
                );
                //display the snack bar
                ScaffoldMessenger.of(context).showSnackBar(snackBar);
              },
              style: ElevatedButton.styleFrom(
                backgroundColor: Colors.blue,
                foregroundColor: Colors.white,
                // shape: BeveledRectangleBorder(
                //   borderRadius: BorderRadius.circular(
                //     5.0,
                //   ),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(10.0),
                ),
              ),
              child: const Text(
                "Elevated Button",
              ),
            ),

AI PILIPINO MUSIC

The YouTube channel  AI PILIPINO MUSIC   presents itself as a niche platform offering content that seems to span a unique blend of creativit...