new_album_list_widget.dart 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import 'package:dotted_border/dotted_border.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:photos/theme/ente_theme.dart';
  4. ///https://www.figma.com/file/SYtMyLBs5SAOkTbfMMzhqt/ente-Visual-Design?node-id=10854%3A57947&t=H5AvR79OYDnB9ekw-4
  5. class NewAlbumListItemWidget extends StatelessWidget {
  6. const NewAlbumListItemWidget({
  7. super.key,
  8. });
  9. @override
  10. Widget build(BuildContext context) {
  11. final textTheme = getEnteTextTheme(context);
  12. final colorScheme = getEnteColorScheme(context);
  13. const sideOfThumbnail = 60.0;
  14. return LayoutBuilder(
  15. builder: (context, constraints) {
  16. return Stack(
  17. alignment: Alignment.center,
  18. children: [
  19. Row(
  20. children: [
  21. ClipRRect(
  22. borderRadius: const BorderRadius.horizontal(
  23. left: Radius.circular(4),
  24. ),
  25. child: SizedBox(
  26. height: sideOfThumbnail,
  27. width: sideOfThumbnail,
  28. child: Icon(
  29. Icons.add_outlined,
  30. color: colorScheme.strokeMuted,
  31. ),
  32. ),
  33. ),
  34. Padding(
  35. padding: const EdgeInsets.only(left: 12),
  36. child: Text(
  37. "New album",
  38. style:
  39. textTheme.body.copyWith(color: colorScheme.textMuted),
  40. ),
  41. ),
  42. ],
  43. ),
  44. IgnorePointer(
  45. child: DottedBorder(
  46. dashPattern: const [4],
  47. color: colorScheme.strokeFainter,
  48. strokeWidth: 1,
  49. padding: const EdgeInsets.all(0),
  50. borderType: BorderType.RRect,
  51. radius: const Radius.circular(4),
  52. child: SizedBox(
  53. //Have to decrease the height and width by 1 pt as the stroke
  54. //dotted border gives is of strokeAlign.center, so 0.5 inside and
  55. // outside. Here for the row, stroke should be inside so we
  56. //decrease the size of this sizedBox by 1 (so it shrinks 0.5 from
  57. //every side) so that the strokeAlign.center of this sizedBox
  58. //looks like a strokeAlign.inside in the row.
  59. height: sideOfThumbnail - 1,
  60. //This width will work for this only if the row widget takes up the
  61. //full size it's parent (stack).
  62. width: constraints.maxWidth - 1,
  63. ),
  64. ),
  65. ),
  66. ],
  67. );
  68. },
  69. );
  70. }
  71. }