Sure! I have added another container inside the existing container. Here's the updated code:
I added a new container inside the
Code:
import 'package:flutter/material.dart';
class ColorPalettePage extends StatefulWidget {
final bool isDarkModeEnabled;
ColorPalettePage({required this.isDarkModeEnabled});
@override
State<ColorPalettePage> createState() => _ColorPalettePageState();
}
class _ColorPalettePageState extends State<ColorPalettePage> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: widget.isDarkModeEnabled ? ThemeData.dark() : ThemeData.light(),
home: Scaffold(
appBar: AppBar(
title: Text('Color Palette'),
backgroundColor: Colors.deepPurple,
),
body: GridView.count(
crossAxisCount: 2,
children: List.generate(14, (index) {
return Container(
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
border: Border.all(color: Color(0xffe3d9d9)),
color: Color(0xffe3d9d9),
boxShadow: const [
BoxShadow(
color: Color(0x3f000000),
offset: Offset(0, 4),
blurRadius: 2,
),
BoxShadow(
color: Color(0x3f000000),
offset: Offset(5, 4),
blurRadius: 2,
),
],
),
child: Stack(
children: [
Align(
alignment: Alignment.bottomLeft,
child: Padding(
padding: EdgeInsets.all(8),
child: Text(
"Your Text Here", // Replace with your desired text
style: TextStyle(
color: Colors.black, // Customize the text color
fontSize: 16, // Customize the font size
),
),
),
),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: EdgeInsets.all(8),
child: Image.asset(
'assets/copybutton.png', // Replace with the path to your image
width: 24, // Set the desired width for the image
height: 24, // Set the desired height for the image
),
),
),
Container(
// Nested Container
width: double.infinity,
height: double.infinity,
color: Colors.red, // Replace with your desired color
),
],
),
);
}),
),
floatingActionButton: SizedBox(
width: 80, // Set the desired width
height: 80, // Set the desired height
child: FloatingActionButton(
onPressed: () {},
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color(0x3f000000),
offset: Offset(0, 4),
blurRadius: 2,
),
BoxShadow(
color: Color(0x3f000000),
offset: Offset(5, 4),
blurRadius: 2,
),
],
),
padding: EdgeInsets.all(20),
child: Image.asset('assets/square icon.png'),
),
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
),
);
}
}
I added a new container inside the
Stack
widget, right after the existing child widgets. I also set the width
and height
of the new container to double.infinity
to make it expand to fill the available space. Feel free to replace the color with your desired color.