Untitled
unknown
plain_text
2 years ago
2.1 kB
8
Indexable
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Elevated Button Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Elevated Button Example'),
backgroundColor: Colors.amber,
foregroundColor: Colors.black, // Set the color of the AppBar to yellow
),
body: Center(
child: SizedBox(
width: 300,
height: 50,
child: ElevatedButton(
onPressed: () {
// Action to perform when the button is pressed
print('Button pressed!');
},
style: ElevatedButton.styleFrom(
primary: Colors
.amber, // Set the background color of the button to yellow
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10.0), // Make the button more rounded
side: const BorderSide(color: Colors.black,style: BorderStyle.solid),
// Add a black outline
),
minimumSize: const Size(20, 60),
),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
'Elevated Button',
style: TextStyle(
color: Colors.black,
fontSize: 30,
// Set the text color to black
),
),
Icon(
Icons.shopping_cart,
color: Colors.black,
)
]),
),
)),
);
}
}
Editor is loading...