Чтобы создать горизонтальный разделитель в ряду с помощью Flutter, вы можете использовать несколько методов. Вот несколько примеров:
-
Использование контейнера с BoxDecoration:
Row( children: [ Container( height: 1, width: double.infinity, decoration: BoxDecoration( color: Colors.grey, ), ), // Other widgets in the row ], ) -
Использование виджета «Разделитель»:
Row( children: [ Divider( color: Colors.grey, height: 1, ), // Other widgets in the row ], ) -
Использование SizedBox с высотой и шириной:
Row( children: [ SizedBox( height: 1, width: double.infinity, child: Container( color: Colors.grey, ), ), // Other widgets in the row ], ) -
Использование пользовательского виджета:
class HorizontalDivider extends StatelessWidget { final Color color; final double thickness; HorizontalDivider({this.color = Colors.grey, this.thickness = 1}); @override Widget build(BuildContext context) { return Container( height: thickness, width: double.infinity, color: color, ); } } // Usage: Row( children: [ HorizontalDivider(color: Colors.grey, thickness: 1), // Other widgets in the row ], )
Это всего лишь несколько примеров того, как можно создать горизонтальный разделитель в ряду с помощью Flutter. Не стесняйтесь изменять фрагменты кода в соответствии со своими требованиями.