when I add a textbutton next to the button in my application, it separates by itself. Like in the photo. How can I zoom plugins?.............................................................................................................................................................
LikeAnimation(
isAnimating:
(snap.data()! as dynamic)['likes']
.contains(FirebaseAuth.instance.currentUser!.uid),
smallLike: true,
child: IconButton(
onPressed: () async {
await FirestoreMethods().LikePost(
(snap.data()!
as dynamic)['postId'],
FirebaseAuth
.instance.currentUser!.uid,
(snap.data()!
as dynamic)['likes'],
);
},
icon: (snap.data()!
as dynamic)['likes']
.contains(FirebaseAuth
.instance
.currentUser!
.uid)
? const Icon(
Icons.favorite,
color: Colors.red,
)
: const Icon(
Icons.favorite_border,
),
),
),
Container(
child: DefaultTextStyle(
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(
fontWeight: FontWeight.w800,
),
child: TextButton(
onPressed: () =>
Navigator.of(context)
.push(MaterialPageRoute(
builder: (context) =>
LikeScreen(
snap: (snapshot.data!
as dynamic)
.docs[index],
),
)),
child: Text(
'${(snap.data()! as dynamic)['likes'].length}',
style: Theme.of(context)
.textTheme
.bodyText2,
),
),
CodePudding user response:
You can use InkWell
instead of textbutton
, like this:
Row(
children: [
IconButton(
icon: Icon(Icons.favorite),
padding: EdgeInsets.zero,
onPressed: () {},
),
InkWell(
onTap: () {},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('1'),
),
),
],
)
CodePudding user response:
Try to provide padding.
TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),