xxxxxxxxxx
OutlinedButton(
onPressed: (){},
child: const Text('OutlinedButton')
),
xxxxxxxxxx
OutlinedButton(
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
side: BorderSide(
color: Colors.red,
)),
onPressed: () {},
child: Text('Start Over')),
xxxxxxxxxx
OutlinedButton(
child: Text('Example'),
onPressed: () {
print('Pressed');
},
)
xxxxxxxxxx
// Basic
OutlinedButton(
child: const Text('Click Me'),
onPressed: () {
debugPrint('Clicked'),
},
),
// Icon and Text
OutlinedButton.icon(
icon: const Icon(Icons.shopping_cart),
label: const Text('My Cart'),
onPressed: () {},
),
// RoundedRectangle with border
OutlinedButton(
child: const Icon(Icons.add),
style: OutlinedButton.styleFrom(
shape: const StadiumBorder(), // ***
side: const BorderSide(
color: Colors.green,
width: 2,
),
),
onPressed: () {},
),
// Custom width and height of OutlineButton ( padding )
OutlinedButton(
child: const Icon(Icons.add),
style: OutlinedButton.styleFrom(
minimumSize: const Size(0, 0), // 1. Set size: width, height = 0
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), // 2. Set padding
),
onPressed: () {},
),
// ***** Global
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: _title,
theme: ThemeData(
// *** Global
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
minimumSize: const Size(0, 0),
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
primary: Colors.white,
backgroundColor: const Color.fromARGB(255, 47, 150, 0),
shadowColor: Colors.orange,
elevation: 5,
side: const BorderSide(
color: Color.fromARGB(255, 110, 84, 147), width: 4),
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
),
home: const HomeScreen(),
);
}
xxxxxxxxxx
OutlinedButton(
onPressed: () {
// Add your desired action here
},
child: Text('Outline Button'),
)