IconButton
sample.packages.flutter.lib.src.material.icon_button.85.
In this sample the icon button's background color is defined with an [Ink] widget whose child is an [IconButton]. The icon button's filled background is a light shade of blue, it's a filled circle, and it's as big as the button is.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const MyStatelessWidget(),
),
);
}
}
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
@override
Widget build(BuildContext context) {
return Material(
color: Colors.white,
child: Center(
child: Ink(
decoration: const ShapeDecoration(
color: Colors.lightBlue,
shape: CircleBorder(),
),
child: IconButton(
icon: const Icon(Icons.android),
color: Colors.white,
onPressed: () {},
),
),
),
);
}
}
SHARE: