From 1c440cb019995e12d62a3494e834127048346a23 Mon Sep 17 00:00:00 2001 From: Adam Stolarczyk Date: Fri, 5 Jul 2024 11:48:26 +0200 Subject: [PATCH] fixes review/2 --- lib/barcode_detail_page.dart | 4 +++- lib/barcode_item.dart | 1 + lib/barcode_item_widget.dart | 3 ++- lib/barcodes_list_view.dart | 45 +++++++++++++++--------------------- lib/barcodes_panel.dart | 3 ++- 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/lib/barcode_detail_page.dart b/lib/barcode_detail_page.dart index bcb244e..f22d63c 100644 --- a/lib/barcode_detail_page.dart +++ b/lib/barcode_detail_page.dart @@ -26,4 +26,6 @@ class BarcodeDetailPage extends StatelessWidget { ), ); } -} \ No newline at end of file +} + + diff --git a/lib/barcode_item.dart b/lib/barcode_item.dart index 972c7d5..0eb0067 100644 --- a/lib/barcode_item.dart +++ b/lib/barcode_item.dart @@ -50,3 +50,4 @@ class BarcodeItem { type: Barcode.ean13()), ]; } + diff --git a/lib/barcode_item_widget.dart b/lib/barcode_item_widget.dart index 9d6aa90..c4c8bcd 100644 --- a/lib/barcode_item_widget.dart +++ b/lib/barcode_item_widget.dart @@ -37,4 +37,5 @@ class BarcodeItemWidget extends StatelessWidget { ], ); } -} \ No newline at end of file +} + diff --git a/lib/barcodes_list_view.dart b/lib/barcodes_list_view.dart index 38173d3..ed7752d 100644 --- a/lib/barcodes_list_view.dart +++ b/lib/barcodes_list_view.dart @@ -32,35 +32,26 @@ class BarcodesListView extends StatelessWidget { Widget _buildBarcodeRow(BuildContext context, BarcodeItem leftBarcode, BarcodeItem? rightBarcode) { return Row( children: [ - Expanded( - child: GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => BarcodeDetailPage(barcode: leftBarcode), - ), - ); - }, - child: BarcodeItemWidget(barcode: leftBarcode), - ), - ), + _buildBarcodeItem(context, leftBarcode), const SizedBox(width: 10), - if (rightBarcode != null) - Expanded( - child: GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => BarcodeDetailPage(barcode: rightBarcode), - ), - ); - }, - child: BarcodeItemWidget(barcode: rightBarcode), - ), - ), + if (rightBarcode != null) _buildBarcodeItem(context, rightBarcode), ], ); } + + Widget _buildBarcodeItem(BuildContext context, BarcodeItem barcode) { + return Expanded( + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => BarcodeDetailPage(barcode: barcode), + ), + ); + }, + child: BarcodeItemWidget(barcode: barcode), + ), + ); + } } \ No newline at end of file diff --git a/lib/barcodes_panel.dart b/lib/barcodes_panel.dart index e2c988c..d42f158 100644 --- a/lib/barcodes_panel.dart +++ b/lib/barcodes_panel.dart @@ -62,4 +62,5 @@ class BarcodesPanelState extends State { ), ); } -} \ No newline at end of file +} +