How can I get this type of rounded background in Text
widget?
Text widget with circular background in flutter
Asked Answered
You can achieve it by
CircleAvatar(
backgroundColor: Colors.grey,
child: Center(
child: Text(
"B",
style: TextStyle(color: Colors.black),
),
),
)
Screenshot:
You can also use ClipOval
ClipOval(
child: Container(
color: Colors.grey,
padding: EdgeInsets.symmetric(horizontal: 30),
child: Text(
"B",
style: TextStyle(color: Colors.black, fontSize: 90),
),
),
)
You can use BoxDecoration
:
Container(
width: 30,
height: 30,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
),
child: const Text('B'),
);
Just use a FAB:
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.grey,
child: Text(
"A",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.italic,
),
),
)
© 2022 - 2024 — McMap. All rights reserved.