at main 1.2 kB view raw
1import 'package:flutter/material.dart'; 2 3class CameraPills extends StatelessWidget { 4 final List<String> cameras; 5 final EdgeInsetsGeometry? padding; 6 const CameraPills({super.key, required this.cameras, this.padding}); 7 8 @override 9 Widget build(BuildContext context) { 10 final theme = Theme.of(context); 11 if (cameras.isEmpty) return SizedBox.shrink(); 12 return Padding( 13 padding: padding ?? EdgeInsets.zero, 14 child: Wrap( 15 spacing: 8, 16 runSpacing: 4, 17 children: cameras 18 .map( 19 (camera) => Container( 20 padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), 21 decoration: BoxDecoration( 22 color: theme.colorScheme.surface, 23 borderRadius: BorderRadius.circular(999), 24 ), 25 child: Text( 26 '📷 $camera', 27 style: TextStyle( 28 color: theme.colorScheme.onSurface, 29 fontWeight: FontWeight.w500, 30 fontSize: 12, 31 ), 32 ), 33 ), 34 ) 35 .toList(), 36 ), 37 ); 38 } 39}