how to remove list tile separator flutter - flutter

i want to remove the line under the list tile item like in the image :
..
note that my list tile is without ListView here is my code :
ListTile(
leading: ClipRRect(borderRadius: BorderRadius.circular(50),child:Image.memory(base64Decode(society['image'])
title: Text(society['Society_Name'] ),),
trailing: ElevatedButton(onPressed: (){
}, child: Icon(Icons.email_outlined, size: 25,), style: ElevatedButton.styleFrom(backgroundColor: green),),
),

Try below code and use Themes
Theme(
data: Theme.of(context).copyWith(dividerColor: Colors.transparent),
child: ListTile(
title: Text(
'Hello, World!',
),
),
),

Related

Flutter ListTile not aligning correctly

I am trying to use ListTile to create a list of options inside my drawer, written like this:
ListTile(
contentPadding: EdgeInsets.fromLTRB(15, 20, 0, 0),
leading: IconTheme(
data: Theme.of(context).iconTheme,
child: new Icon(FontAwesomeIcons.diceD6),
),
title: Text(
'FREE ASSETS',
style: Theme.of(context).textTheme.headlineMedium,
),
),
ListTile(
leading: IconTheme(
data: Theme.of(context).iconTheme,
child: new Icon(FontAwesomeIcons.folderOpen),
),
title: Text(
'RESOURCE COLLECTION',
style: Theme.of(context).textTheme.headlineMedium,
)),
ListTile(
leading: IconTheme(
data: Theme.of(context).iconTheme,
child: new Icon(FontAwesomeIcons.chalkboard),
),
title: Text(
'LESSONS',
style: Theme.of(context).textTheme.headlineMedium,
)),
ListTile(
leading: IconTheme(
data: Theme.of(context).iconTheme,
child: new Icon(FontAwesomeIcons.solidRectangleList),
),
title: Text(
'NEWSLETTER',
style: Theme.of(context).textTheme.headlineMedium,
)),
],
),
My issue is that the icons and text are not aligned with each other.
I have not added any padding or margins to the icon and I suspect its because its aligning it to the bottom however I am unsure. Is there a way for me to fix the alignment of the icons or text?
Thank you for the help!
Edit:
By adding horizontalTitleGap: 0 it reduces the space however they are still not aligned with each other.

flutter collapsible & expandable button UI

I am trying to design this UI but I am having problems creating it. Currently using expansion tile but I am not able to get desired results.
This is what I have tried right now
ExpansionTile(
collapsedBackgroundColor: Colors.amber,
textColor: Colors.black,
title: Text("Health"),
children: [
Text("children 1"),
Text("children 2"),
ElevatedButton(onPressed: (() {}),
child: Text('Health'),
style: ElevatedButton.styleFrom(
elevation: 1,
primary: Colors.amber
),
),
],
),

how i can change place of ElevatedButton

#override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: const Icon(Icons.home),
automaticallyImplyLeading: true,
title: const Text('test app'),
foregroundColor: Colors.black,
actions: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.menu),
),
],
),
body: Container(
child: Column(
children: [
Row(
children: [
const Text(
'New',
style: TextStyle(
color: Colors.black54,
fontSize: 40,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
height: 2,
shadows: [
Shadow(color: Colors.black12, offset: Offset(4, 10))
]),
),
ElevatedButton.icon(onPressed: (){}, icon: Icon(Icons.navigate_next),label: Text(' '),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.grey),
),
),
],
),
Row(),
],
),
),
),
);
}
use the Row widget properties for laying out its childrens
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [....]
)
the official docs are helpful in that matter
https://api.flutter.dev/flutter/widgets/Row-class.html
sidenote: if you are not planning to use any of the first container() properties then its better to get rid of it
There are 4 options u can use depending on what you want
If u want it below new u can use Column instead of Row .
If u want to put some space next to new u can use SizedBox(width:X) between the Text and the elevated button.
You can use mainAxisAlignment or crossAxisAlignment inside the row or column to customize the position
you can find examples about them here https://docs.flutter.dev/development/ui/layout
you can use margin or padding on elevated button to customize its own position

Flutter: ShowDialog not working with the OnTap() method of a ListTile

I am using a drawer to create a menu that houses ListTiles for the options. I want to create a popup when the tiles are tapped by the user. Currently, the code displays nothing when the tiles are tapped even though after the showDialog there is a Navigator.pop().
// Drawer that includes the ListTiles in question
Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Text('Smash Tracker'),
),
),
ListTile(
title: Text(
'About',
style: TextStyle(
fontFamily: 'Smash',
fontSize: 15.0,
color: Color.fromRGBO(77, 114, 152, 1.0),
),
),
onTap: () {
// Show PopUp
showDialog(context: context, child:
new AlertDialog(
title: new Text(
'About',
style: TextStyle(fontFamily: "Smash"),
),
content: new Text(
'This is a placeholder. This is a placeholder. This is a placeholder. This is a placeholder.',
style: TextStyle(fontFamily: "Smash"),
),
)
);
// Doesn't run
Navigator.pop(context);
},
),
Here is a demo:
via GIPHY
The other ListTiles have the only have Navigator.pop() inside of their onTap() method.
The dialog isn't showing because you are popping it immediately with the Navigator.pop(context). You can await the Dialog since it returns a Future<T> before popping.
I added a demo using your widget tree as an example:
Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Text('Smash Tracker'),
),
ListTile(
title: Text(
'About',
style: TextStyle(
fontFamily: 'Smash',
fontSize: 15.0,
color: Color.fromRGBO(77, 114, 152, 1.0),
),
),
onTap: () async { // mark the function as async
print('tap');
// Show PopUp
// await the dialog
await showDialog(
context: context,
child: new AlertDialog(
title: new Text(
'About',
style: TextStyle(fontFamily: "Smash"),
),
content: new Text(
'This is a placeholder. This is a placeholder. This is a placeholder. This is a placeholder.',
style: TextStyle(fontFamily: "Smash"),
),
));
// Doesn't run
Navigator.pop(context);
},
),
],
),
),
OUTPUT:

Flutter: How can I make leading icon space?

I am new to Flutter and I am trying to create a pop up menu. How can I make leading icon space? When I set null, the layout will be like the picture below. And when I try to set IconButton's icon null, the menu can't be opened.
The code is like this.
PopupMenuItem(
child: ListTile(
leading: null,
title: Text(
'Item3',
style: TextStyle(
color: Palette.whiteDarken1,
),
),
),
),
PopupMenuItem(
child: ListTile(
leading: IconButton(
icon: Icon(
Icons.exit_to_app,
color: Palette.whiteDarken1,
),
),
title: Text(
'Log In',
style: TextStyle(
color: Palette.whiteDarken1,
),
),
),
),
you can use a sizedbox with size as per your icon size for leading widget