mirror of
https://github.com/openfoodfacts/smooth-app.git
synced 2025-08-26 11:16:45 +08:00

* feat: Create a screen listing all attributes for a product - resolves: #4673 - I have just added a simple button in edit product page just to test the new page. It will be removed and added in the paticular screen. - taking `edit_product_page.dart` as a base `product_attribute_page.dart` is designed as suggested by teolemon. - Added all the mentioned section field in the issue. * refactor: chnages done according to the feedback - created seperte file for `svg_icon.dar` - created newFile for `attribute_first_row_widget.dart` - removed refreshIndicator - useed stringbuffer for string concatenation - fix: linting errors * fix: move nutrients extraction to init state - to avoid recalculation on every build * remove usage of knowledgepanel, use product.nutriments * move ingredient extraction to initstate * helper abstract class for attribute_first_row_widget * remove ui file and abstract ontap function * tiny fix * change ontap function to future<void> * Update packages/smooth_app/lib/pages/product/attribute_first_row_helper.dart --------- Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
42 lines
1.2 KiB
Dart
42 lines
1.2 KiB
Dart
import 'dart:ui' as ui;
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:smooth_app/generic_lib/design_constants.dart';
|
|
import 'package:smooth_app/helpers/app_helper.dart';
|
|
|
|
/// SVG that looks like a ListTile icon.
|
|
class SvgIcon extends StatelessWidget {
|
|
const SvgIcon(this.assetName, {this.dontAddColor = false});
|
|
|
|
final String assetName;
|
|
final bool dontAddColor;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => SvgPicture.asset(
|
|
assetName,
|
|
height: DEFAULT_ICON_SIZE,
|
|
width: DEFAULT_ICON_SIZE,
|
|
colorFilter: dontAddColor
|
|
? null
|
|
: ui.ColorFilter.mode(
|
|
_iconColor(Theme.of(context)),
|
|
ui.BlendMode.srcIn,
|
|
),
|
|
package: AppHelper.APP_PACKAGE,
|
|
);
|
|
|
|
/// Returns the standard icon color in a [ListTile].
|
|
///
|
|
/// Simplified version from [ListTile], which was anyway not kind enough
|
|
/// to make it public.
|
|
Color _iconColor(ThemeData theme) {
|
|
switch (theme.brightness) {
|
|
case Brightness.light:
|
|
return Colors.black45;
|
|
case Brightness.dark:
|
|
return Colors.white;
|
|
}
|
|
}
|
|
}
|