forked from openfoodfacts/smooth-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standard info tile about "owner fields"
New file: * `owner_field_info.dart`: Standard info tile about "owner fields". Impacted files: * `add_basic_details_page.dart`: now displaying `OwnerFieldInfo` if relevant; minor refactoring * `nutrition_page_loaded.dart`: now displaying `OwnerFieldInfo` if relevant; minor refactoring * `product_query.dart`: moved field to new file `owner_field_info.dart`
- Loading branch information
1 parent
10278bf
commit fabeed9
Showing
4 changed files
with
98 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/smooth_app/lib/pages/product/owner_field_info.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Standard info tile about "owner fields". | ||
class OwnerFieldInfo extends StatelessWidget { | ||
const OwnerFieldInfo({super.key}); | ||
|
||
/// Icon to display when the product field value is "producer provided". | ||
static const IconData ownerFieldIconData = Icons.factory; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final bool dark = Theme.of(context).brightness == Brightness.dark; | ||
final Color? darkGrey = Colors.grey[700]; | ||
final Color? lightGrey = Colors.grey[300]; | ||
return ListTile( | ||
tileColor: dark ? darkGrey : lightGrey, | ||
leading: const Icon(ownerFieldIconData), | ||
// TODO(monsieurtanuki): localize | ||
title: const Text('Producer provided values'), | ||
subtitle: const Text( | ||
'With that logo we highlight data provided by the producer, and that may not be editable.'), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters