Skip to content

Commit

Permalink
Improve UX
Browse files Browse the repository at this point in the history
- Remove filter box focus when tapped outside
- Set product list separator size to 1
- Make background of report pages white
  • Loading branch information
dipu-bd committed Jun 9, 2021
1 parent 343ed65 commit 3236284
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
37 changes: 27 additions & 10 deletions lib/src/pages/widgets/product_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ProductItemTile extends StatelessWidget {
subtitle: buildSubtitle(),
trailing: buildPrice(),
onLongPress: () => _saleProduct(context),
onTap: () => FocusScope.of(context).unfocus(),
),
),
actions: <Widget>[
Expand Down Expand Up @@ -83,25 +84,41 @@ class ProductItemTile extends StatelessWidget {
return Text.rich(
TextSpan(
children: [
TextSpan(text: 'Each unit costs '),
TextSpan(text: 'Added on '),
TextSpan(
text: product.unitCostStr,
text: product.dateStr,
style: TextStyle(
fontWeight: FontWeight.w600,
fontFamily: 'monospace',
fontWeight: FontWeight.bold,
),
),
],
),
);
}

Text buildPrice() {
return Text(
product.costStr,
style: TextStyle(
fontWeight: FontWeight.w600,
fontFamily: 'monospace',
Widget buildPrice() {
return Container(
constraints: BoxConstraints(
minWidth: 75,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
product.costStr,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
Text(
'${product.quantity} × ${product.unitCostStr}',
style: TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
],
),
);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/pages/widgets/product_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class _ProductListViewState extends State<ProductListView> {
return ListView.separated(
itemCount: filteredProducts.length + 2,
padding: EdgeInsets.only(bottom: 100, top: 0),
separatorBuilder: (context, index) => Container(height: 5),
separatorBuilder: (context, index) => Container(height: 1),
itemBuilder: (context, index) {
if (index == 0) {
return buildFilterInput();
Expand Down Expand Up @@ -82,10 +82,10 @@ class _ProductListViewState extends State<ProductListView> {
}

Widget buildFilterInput() {
if (widget.products.length < 7) {
if (widget.products.length < 8) {
return Container();
}
return Padding(
return Container(
padding: EdgeInsets.all(8.0),
child: TextField(
controller: filterInput,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pages/widgets/report_page_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ReportPageWidget<T extends Report> extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[300],
backgroundColor: Colors.white,
appBar: AppBar(
title: Text(titleText),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: sales_tracker
description: A generic sales tracking application
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.2.1+4
version: 1.2.2+5

environment:
sdk: ">=2.13.0 <3.0.0"
Expand Down

0 comments on commit 3236284

Please sign in to comment.