I was working on grid views and got stuck when trying to insert expansion tiles inside the grid view.The problem that i am facing is, when tring to expand the tile, i am getting an overflow error. Is there any way to use expansion tile inside grid view in such a way that when one of the tiles is expanded, the other tiles moves down without causing any overflow error ?
Here's my code snippet :
Expanded(
child: GridView.builder(
itemCount: 21,
physics: BouncingScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: (1 / 0.46),
crossAxisCount:
(MediaQuery.of(context).orientation ==
Orientation.landscape)
? 4
: 1,
),
itemBuilder:
(BuildContext context, int index) => Card(
elevation: 6.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: ExpansionTile(
// collapsedBackgroundColor: Colors.white,
// backgroundColor: Colors.white,
trailing: FadeInImage.memoryNetwork(
image:
'https://picsum.photos/250?image=123',
placeholder: kTransparentImage,
),
title: Container(
child: Text(
'Pencil Pen Test Long String Again Test Long String',
),
),
subtitle: Padding(
padding:
const EdgeInsets.only(top: 8.0),
child: Text(
'\u{20B9} $myAmount',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Align(
alignment: Alignment.topLeft,
child: Text('Price 1 :' +
' \u{20B9} $myAmount'),
),
Align(
alignment: Alignment.topLeft,
child: Text('Price 2 :' +
' \u{20B9} $myAmount'),
),
Align(
alignment: Alignment.topLeft,
child: Text('Price 3 :' +
' \u{20B9} $myAmount'),
),
SizedBox(
height: 6.0,
),
Column(
children: [
Container(
padding:
EdgeInsets.all(20.0),
child: Align(
alignment:
Alignment.centerLeft,
child: Text(
'TAGS',
style: TextStyle(
color: Colors.white,
decoration:
TextDecoration
.underline,
),
),
),
),
Row(
children: [
Expanded(
child: InputChip(
onDeleted: () {},
onPressed: () {},
label: Text('Chip a'),
avatar: Icon(
Icons.ac_unit),
),
),
Expanded(
child: InputChip(
onDeleted: () {},
onPressed: () {},
label: Text('Chip b'),
avatar: Icon(Icons
.e_mobiledata),
),
),
Expanded(
child: InputChip(
onDeleted: () {},
onPressed: () {},
label: Text('Chip c'),
avatar: Icon(Icons
.format_align_justify_outlined),
),
),
],
),
],
),
Divider(),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: <Widget>[
Row(
children: [
Text(
'In Hand : ',
style: TextStyle(
fontWeight:
FontWeight.bold,
color:
Theme.of(context)
.colorScheme
.secondary,
),
),
],
),
Row(
children: [
IconButton(
onPressed: () {
displayBottomSheetAddInventory(
context);
},
icon: Icon(
Icons.add_circle),
),
IconButton(
onPressed: () {
displayBottomSheetSubtractInventory(
context);
},
icon: Icon(Icons
.remove_circle),
),
IconButton(
onPressed: () {
displayBottomSheetEditInventory(
context);
},
icon: Icon(
Icons.edit,
),
),
],
),
],
)
],
),
)
],
),
),
),
),
),
This is what i'm getting:
And this is want i want : (The other tiles should be below this tile and readjust when collapsed.)
Can anyone help ?
Related
the question is exactly same as this post
but I did not find an answer from the post.
my goal is to set the title widget in the center
and other two buttons on the right side.
the solutions in the link all put the title widget slightly on the left side.
does anyone know how to do this without using Stack? I'm afraid of the title widget being over the button widgets when the title gets too long.
the code:
SizedBox(
height: 40,
width: MediaQuery.of(context).size.width,
child: Row(
children: [
const SizedBox(width: 17),
Text(
'TITLE',
style: const TextStyle(
color: Colors.white, fontSize: 30, fontWeight: FontWeight.w500),
),
Spacer(),
Row(
children: [
GestureDetector(
onTap: (){null;},
child: SizedBox(
child: Icon(Icons.wallet_membership, color: Colors.white),
),
),
const SizedBox(width: 17),
GestureDetector(
onTap: (){Get.toNamed('/wallet_setting');},
child: const SizedBox(
child: Icon(Icons.settings, color: Colors.white),
),
),
]
)
]
),
)
Try this One
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Container(
child: Center(
child: Text(
'TITLE',
style: const TextStyle(color: Colors.white, fontSize: 30, fontWeight: FontWeight.w500),
),
)
)
),
Align(
alignment: Alignment.centerRight,
child: Row(
children: [
GestureDetector(
onTap: (){null;},
child: SizedBox(
child: Icon(Icons.wallet_membership, color: Colors.white),
),
),
const SizedBox(width: 17),
GestureDetector(
onTap: (){Get.toNamed('/wallet_setting');},
child: const SizedBox(
child: Icon(Icons.settings, color: Colors.white),
),
),
]
)
)
],
)
OutPut:
i think you should wrap it with centre
Try this approach:
first make widget from your right widgets:
Widget _rightIcons() {
return Row(children: [
GestureDetector(
onTap: () {
null;
},
child: SizedBox(
child: Icon(Icons.wallet_membership, color: Colors.white),
),
),
const SizedBox(width: 17),
GestureDetector(
onTap: () {
Get.toNamed('/wallet_setting');
},
child: const SizedBox(
child: Icon(Icons.settings, color: Colors.white),
),
),
]);
}
then build your header like this:
Row(
children: [
_rightIcons(),
Expanded(
child: Center(
child: Text(
'TITLE',
style: const TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.w500),
),
),
),
Opacity(
opacity: 0,
child: _rightIcons(),
)
],
),
You can use centerTitle:true on Appbar
appBar: AppBar(
centerTitle: true,
title: Text("title"),
actions: [
Another way
Container(
color: Colors.purple,
height: 40 * 2,
width: MediaQuery.of(context).size.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconButton(onPressed: () {}, icon: Icon(Icons.navigate_before)),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: SizedBox(),
),
Expanded(
flex: 4,
child: Text(
'TITLE',
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.w500),
),
),
Expanded(
flex: 1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
child: Icon(Icons.wallet_membership,
color: Colors.white),
),
const SizedBox(width: 17),
GestureDetector(
onTap: () {},
child: const SizedBox(
child:
Icon(Icons.settings, color: Colors.white),
),
),
]),
),
)
],
),
],
),
)
Preferable solution:
You can implements PreferredSizeWidget to create custom Appbar. Play with color and other decoration.
class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
const MyAppBar({super.key});
#override
Widget build(BuildContext context) {
return Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
child: Text("title"),
),
Align(
alignment: Alignment.bottomRight,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
//you can use callback method to get onpressed
onPressed: () {},
icon: Icon(Icons.settings),
),
IconButton(
onPressed: () {},
icon: Icon(Icons.settings),
),
],
),
)
],
);
}
#override
Size get preferredSize => const Size.fromHeight(kToolbarHeight * 2);
}
And use like appBar: MyAppBar(),
Folloing is my alert dialog box code, i need to set an background image for the alert dialog instead of blue color, need to show a design
AlertDialog(
backgroundColor: Colors.blue,
titlePadding: EdgeInsets.all(0),
contentPadding: EdgeInsets.all(0),
title: Container(
decoration: BoxDecoration(
color: profile_edit_toolbar_color,
borderRadius: BorderRadius.all(Radius.circular(8))),
width: MediaQuery.of(context).size.width * 0.7,
height: MediaQuery.of(context).size.height * 0.5,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(18),
child: Text(
'Select countries to show',
style: TextStyle(
color: Colors.yellow[300],
fontSize: 20,
fontFamily: fontFamily_3),
// style: CustomStyle.balooCustom(20, Colors.white)
),
),
IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: Icon(
Icons.close,
size: 25,
color: Colors.white,
)),
],
),
Row(
children: [
Expanded(
child: Container(
height: 120,
child: DisplayCountriesForm(
countriesList: eventResponse.countriesList,
num: 0,
displayCountries: displayCountries,
onValueChanged: (updatedList) {
},
),
)),
Expanded(
child: Container(
height: 120,
child: DisplayCountriesForm(
countriesList: eventResponse.countriesList,
num: 1,
displayCountries: displayCountries,
onValueChanged: (updatedList) {
},
),
)),
Expanded(
child: Container(
height: 120,
child: DisplayCountriesForm(
countriesList: eventResponse.countriesList,
num: 2,
displayCountries: displayCountries,
onValueChanged: (updatedList) {
},
),
)),
],
),
],
),
),
);
Try below code I have add background image of the alert dialog hope your problem is solved , Use your widget also and change background image on your need
TextButton(
child: Text('Pressed Me'),
onPressed: () => showDialog(
context: context,
builder: (context) => AlertDialog(
content: Stack(
alignment: Alignment.center,
children: <Widget>[
Image.network(
'https://www.kindpng.com/picc/m/355-3557482_flutter-logo-png-transparent-png.png',
),
Text(
'Add Your Text Here',
style: TextStyle(
fontSize: 24,
),
),
],
),
),
),
),
Your Result Screen->
Now I am adding a scrollbar to my app, this is my code:
final ScrollController _scrollController = ScrollController();
return GestureDetector(
onHorizontalDragStart: _onHorizontalDragStart,
onHorizontalDragUpdate: _onHorizontalDragUpdate,
onHorizontalDragEnd: _onHorizontalDragEnd,
child: Container(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height * 0.9,
),
color: Theme.of(context).scaffoldBackgroundColor,
child: CupertinoScrollbar(
isAlwaysShown: true,
controller: _scrollController,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: buildListView(item, context),
),
)));
but in the UI, I did not find the ScrollBar. How to make the scrollbar show on the UI? or like inspect element like html in Chrome. this is the UI:
I have wake up the Flutter Inspector, but when I click the element, nothing happen in the emulator. Now I am using SingleChildScrollView:
SingleChildScrollView buildListView(Item item, BuildContext context) {
return SingleChildScrollView(
controller: _scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
InkWell(
onTap: () => CommonUtils.launchUrl(item.link),
child: Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Container(
child: Text(
item.title == "" ? "Comment" : item.title,
style: Theme.of(context).textTheme.headline5!.copyWith(
fontWeight: FontWeight.w600,
),
),
),
),
),
if (item.domain != "")
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: InkWell(
onTap: () async {
navToChannelDetail();
},
child: Text(
item.domain,
style: Theme.of(context).textTheme.caption!.copyWith(color: Theme.of(context).primaryColor),
)),
),
InkWell(
onTap: () {},
child: RichText(
text: TextSpan(
children: <TextSpan>[
TextSpan(
text: item.author,
style: Theme.of(context).textTheme.caption,
),
TextSpan(
text: " ${String.fromCharCode(8226)} ",
style: Theme.of(context).textTheme.caption,
),
TextSpan(
text: item.ago,
style: Theme.of(context).textTheme.caption,
),
],
),
),
),
if (item.content != "")
Html(
data: item.content,
style: {
"body": Style(
fontSize: FontSize(19.0),
),
},
//sonLinkTap: (url) => CommonUtils.launchUrl(url),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 16.0),
child: Row(
children: [
if (item.isFav == 1)
IconButton(
icon: Icon(Icons.bookmark, color: Theme.of(context).primaryColor),
onPressed: () => touchFav("unfav", FavStatus.UNFAV),
),
if (item.isFav != 1)
IconButton(
icon: Icon(Icons.bookmark),
onPressed: () => touchFav("fav", FavStatus.FAV),
),
Padding(
padding: const EdgeInsets.only(left: 0.0),
child: Text(
"${item.favCount}",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.caption!.copyWith(
color: Theme.of(context).primaryColor,
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 0.0),
child: Row(
children: [
if (item.isUpvote == 1)
IconButton(
icon: Icon(Icons.thumb_up, color: Theme.of(context).primaryColor),
onPressed: () => touchUpvote("unupvote", UpvoteStatus.UNUPVOTE),
),
if (item.isUpvote != 1)
IconButton(
icon: Icon(Icons.thumb_up),
onPressed: () => touchUpvote("upvote", UpvoteStatus.UPVOTE),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
"${item.upvoteCount}",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.caption!.copyWith(
color: Theme.of(context).primaryColor,
),
),
),
],
),
),
],
),
IconButton(
icon: Icon(
Feather.share_2,
),
onPressed: () => handleShare(id: item.id, title: item.title, postUrl: item.link),
),
],
),
],
));
}
You must add the _scrollController to ListView
You can try this , I hope to help you :
return Container(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height * 0.9,
),
color: Theme.of(context).scaffoldBackgroundColor,
child: CupertinoScrollbar(
isAlwaysShown: true,
controller: _scrollController,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: ListView.builder(
controller: _scrollController,
itemCount: 500,
shrinkWrap: true,
itemBuilder:(_, index){
return Text('Index Number : '+index.toString());
}),
),
));
Problem: As you can see from the pic at the bottom, there is some extra white space above the grid layout that I don't want. I tried adjusting the alignment inside the container to centerTop but that didn't change anything. I think the problem has to do with Container and Gridview being inside an Expanded widget. Not sure how to go about removing that white space. That orange is from a scroll down event in order to show where the white space is. Any help would be much appreciated! Thank you.
Code:
class MyFavorites extends StatefulWidget {
MyFavorites();
_MyFavorites createState() => _MyFavorites();
}
class _MyFavorites extends State<MyFavorites> {
final FavController fC = Get.put(FavController());
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: colorPalette.chooseColor('offWhite'),
body: Column(
children: [
Spacer(flex: 1),
Expanded(
flex: 2,
child: Row(
children: [
Container(
alignment: Alignment.centerLeft,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(Icons.chevron_left),
color: colorPalette.chooseColor('darkGrey'),
),
),
Container(
margin: EdgeInsets.only(left: 23),
alignment: Alignment.centerLeft,
child: Text(
'My Favorites',
style: GoogleFonts.ubuntuCondensed(
color: colorPalette.chooseColor('darkGrey'),
fontSize: 32,
fontWeight: FontWeight.bold),
),
),
],
),
),
Expanded(
flex: 12,
child: Container(
child: GridView.count(
crossAxisCount: 2,
children: List.generate(fC.favItemNamesList.length, (index) {
return Container(
child: Card(
child: Column(
children: [
Expanded(
flex: 3,
child: Stack(
fit: StackFit.expand,
children: [
Image.asset(
'assets/images/empty_image.jpg',
fit: BoxFit.fill,
),
],
),
),
Expanded(
flex: 1,
child: Container(
color: colorPalette.chooseColor('offWhite'),
child: Row(
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
child: IconButton(
icon: Icon(
Icons.add,
color: colorPalette
.chooseColor('purple'),
),
onPressed: () {},
)),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
child: IconButton(
icon: Icon(
Icons.edit,
color: colorPalette
.chooseColor('green'),
),
onPressed: () {},
)),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
child: IconButton(
icon: Icon(
Icons.favorite,
color: Colors.pink,
),
onPressed: () {},
)),
),
],
),
),
),
Expanded(
flex: 1,
child: Container(
color: colorPalette.chooseColor('darkGrey'),
padding: EdgeInsets.only(left: 8),
alignment: Alignment.centerLeft,
child: Obx(
() => Text(fC.favItemNamesList[index],
style: GoogleFonts.ubuntuCondensed(
color: colorPalette
.chooseColor('offWhite'),
fontSize: 13)),
),
),
),
],
),
),
);
}),
),
),
),
],
),
);
}
}
Pic of problem:
Just do it as follows:
remove the first spacer, there is no need for it unless you need the above space. However you can use SafeArea Widget to avoid all the unseen places from the screen automatically if that is what you want.
Remove that container wrapping the grid view
your code should look like:
class MyFavorites extends StatefulWidget {
MyFavorites();
_MyFavorites createState() => _MyFavorites();
}
class _MyFavorites extends State<MyFavorites> {
final FavController fC = Get.put(FavController());
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: colorPalette.chooseColor('offWhite'),
body: Column(
children: [
Expanded(
flex: 2,
child: Row(
children: [
Container(
alignment: Alignment.centerLeft,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(Icons.chevron_left),
color: colorPalette.chooseColor('darkGrey'),
),
),
Container(
margin: EdgeInsets.only(left: 23),
alignment: Alignment.centerLeft,
child: Text(
'My Favorites',
style: GoogleFonts.ubuntuCondensed(
color: colorPalette.chooseColor('darkGrey'),
fontSize: 32,
fontWeight: FontWeight.bold),
),
),
],
),
),
Expanded(
flex: 12,
child: GridView.count(
crossAxisCount: 2,
children: List.generate(fC.favItemNamesList.length, (index) {
return Container(
child: Card(
child: Column(
children: [
Expanded(
flex: 3,
child: Stack(
fit: StackFit.expand,
children: [
Image.asset(
'assets/images/empty_image.jpg',
fit: BoxFit.fill,
),
],
),
),
Expanded(
flex: 1,
child: Container(
color: colorPalette.chooseColor('offWhite'),
child: Row(
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
child: IconButton(
icon: Icon(
Icons.add,
color: colorPalette
.chooseColor('purple'),
),
onPressed: () {},
)),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
child: IconButton(
icon: Icon(
Icons.edit,
color: colorPalette
.chooseColor('green'),
),
onPressed: () {},
)),
),
Expanded(
flex: 1,
child: Container(
alignment: Alignment.center,
child: IconButton(
icon: Icon(
Icons.favorite,
color: Colors.pink,
),
onPressed: () {},
)),
),
],
),
),
),
Expanded(
flex: 1,
child: Container(
color: colorPalette.chooseColor('darkGrey'),
padding: EdgeInsets.only(left: 8),
alignment: Alignment.centerLeft,
child: Obx(
() => Text(fC.favItemNamesList[index],
style: GoogleFonts.ubuntuCondensed(
color: colorPalette
.chooseColor('offWhite'),
fontSize: 13)),
),
),
),
],
),
),
);
}),
),
),
],
),
);
}
}
i am having problems trying to align my widgets. the left side is aligning correctly but the right side is off a little bit.
here is my code
this is the code for the card view
ListView itemList(List<IncomeData> items, AppDatabase database, BuildContext context) {
return ListView(
children: items.map((IncomeData income) {
return Container(
child: Padding(
padding: const EdgeInsets.fromLTRB(15.0, 5.0, 15.0,5.0),
child: new Card( //listView(income),
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0,0.0),
child: new Column(
children: <Widget>[
listView(income),
new ButtonBar(
children: <Widget>[
new RaisedButton.icon(
label: const Text('Edit'),
icon: Icon(Icons.edit,),
color: colorPrimary,
onPressed: () {
_navigateAndDisplaySelection(context, income);
/* Navigator.push(context,
MaterialPageRoute(builder: (context) => AddEditIncomeForm(incomeData: income)));*/
},
),
new RaisedButton.icon(
label: const Text('Delete'),
icon: Icon(Icons.delete),
color: colorPrimary,
onPressed: () {
//database.deleteEntry(income);
//deleteConfirmation(income, database);
showDialog(
context: context,
builder: (context) {
return CheckBoxAlertDialog(transactionType: delete, data: income, database: database,);
}
);
},
),
],
),
],
),
),
)
)
);
}).toList(),
);
}
this is the code for the content of the card view
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(common_functions(incomeList.dateReceived.toString()),
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold )),
Spacer(),
//Expanded(child: SizedBox()),
Text("Not Received"),
Switch(
value: isSwitched,
onChanged: (value) {
setState(() {
isSwitched = value;
print(isSwitched);
});
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
),
]
),
Row(
children: <Widget>[
CircleAvatar(
backgroundColor: green,
child: Icon(Icons.attach_money, color: white,),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(incomeList.category,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold )),
Text(incomeList.frequency + " | " + incomeList.depositAcct, style: TextStyle(color: grey, fontSize: 15)),
],
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text("\$" + incomeList.expectedAmount.toStringAsFixed(2),
style: TextStyle(fontSize: 18, color: green , fontWeight: FontWeight.bold ) ),
Text(incomeList.status, style: TextStyle(color: grey, fontSize: 15)),
],
),
],
),
],
);
if you take a look at the pic attached, the buttons and the top switch is not align properly to the number $68.00. see the red line i drawed. the switch on top is off to the left by a few spaces and also the buttons are the bottom are not align exactly to $68.00
am i doing something wrong that the widgets are not aligning to the red line as $68.00 is? how can i change my code to properly align all the widgets on the right side? thanks in advance
For ButtonBar it's buttonPadding parameter. Just be sure not to use any horizontal padding with it (right or left), since it will split it between the buttons. You will have to add a left padding for the buttons inside the ButtonBar.
I've attached an example for it and for the Switch widget, which doesn't have any properties to modify this behavior, but you can always use Transform.translate to overcome this.
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Transform.translate(
offset: Offset(10.0, 0.0),
child: Switch(
value: true,
onChanged: (value) {},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
),
),
],
),
ButtonBar(
buttonPadding: EdgeInsets.zero,
children: <Widget>[
RaisedButton.icon(
label: const Text('Edit'),
icon: Icon(
Icons.edit,
),
color: Colors.blue,
onPressed: () {},
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: RaisedButton.icon(
label: const Text('Delete'),
icon: Icon(Icons.delete),
color: Colors.blue,
onPressed: () {},
),
),
],
),