|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | +import 'package:stack_overflow_clone/core/base/base_singleton.dart'; |
| 3 | +import 'package:stack_overflow_clone/core/extensions/ui_extensions.dart'; |
| 4 | + |
| 5 | +class LikeAndUserInfo extends StatelessWidget with BaseSingleton { |
| 6 | + final VoidCallback onPressed; |
| 7 | + final Color likeColor; |
| 8 | + final String favLength; |
| 9 | + final String createdAt; |
| 10 | + final String username; |
| 11 | + const LikeAndUserInfo({ |
| 12 | + super.key, |
| 13 | + required this.onPressed, |
| 14 | + required this.likeColor, |
| 15 | + required this.favLength, |
| 16 | + required this.createdAt, |
| 17 | + required this.username, |
| 18 | + }); |
| 19 | + |
| 20 | + @override |
| 21 | + Widget build(BuildContext context) { |
| 22 | + return Row( |
| 23 | + children: [ |
| 24 | + Expanded( |
| 25 | + flex: 2, |
| 26 | + child: Row( |
| 27 | + children: [ |
| 28 | + IconButton( |
| 29 | + onPressed: onPressed, |
| 30 | + icon: Icon( |
| 31 | + Icons.favorite, |
| 32 | + color: likeColor, |
| 33 | + ), |
| 34 | + ), |
| 35 | + context.emptySizedWidthBox2x, |
| 36 | + Expanded( |
| 37 | + child: Text( |
| 38 | + favLength, |
| 39 | + style: context.textTheme.subtitle1!.copyWith( |
| 40 | + fontWeight: context.fw700, |
| 41 | + ), |
| 42 | + ), |
| 43 | + ), |
| 44 | + ], |
| 45 | + ), |
| 46 | + ), |
| 47 | + Expanded( |
| 48 | + child: Wrap( |
| 49 | + children: [ |
| 50 | + Column( |
| 51 | + crossAxisAlignment: context.crossAxisAStart, |
| 52 | + children: [ |
| 53 | + Text( |
| 54 | + createdAt, |
| 55 | + style: context.textTheme.caption! |
| 56 | + .copyWith(color: colors.blue6), |
| 57 | + ), |
| 58 | + Text( |
| 59 | + username, |
| 60 | + style: context.textTheme.caption! |
| 61 | + .copyWith(color: colors.blue8), |
| 62 | + ), |
| 63 | + ], |
| 64 | + ) |
| 65 | + ], |
| 66 | + ), |
| 67 | + ), |
| 68 | + ], |
| 69 | + ); |
| 70 | + } |
| 71 | +} |
0 commit comments