Practise
// Some code
class PractiseLesson extends StatefulWidget {
const PractiseLesson({super.key});
@override
State<PractiseLesson> createState() => _PractiseLessonState();
}
class _PractiseLessonState extends State<PractiseLesson> {
int selectedIndex = 0;
List<IconData> data = [
Icons.account_balance_rounded,
Icons.strikethrough_s,
Icons.add,
Icons.account_circle,
];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey.shade600,
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: SizedBox(
height: 100,
width: double.infinity,
child: Stack(
children: [
Align(
alignment: Alignment.center,
child: Container(
height: 80,
width: double.infinity,
color: Colors.white,
margin: EdgeInsets.symmetric(horizontal: 12),
),
),
Align(
alignment: Alignment.center,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: List.generate(
4,
(e) => InkWell(
onTap: (){
setState(() {
selectedIndex = e;
});
},
child: Container(
height: selectedIndex == e ? 90 : 78,
width: selectedIndex == e ? 90 : 78,
color: selectedIndex == e ? Colors.green : Colors.white,
child: Icon(
data[e],
color: selectedIndex == e ? Colors.white : Colors.black,
),
),
),
).toList(),
),
),
],
),
),
);
}
}Last updated