Merge branch 'claude/intelligent-bardeen-0d5ee9': market detail page, filters, publish-dedup

# Conflicts:
#	apps/app_seeds/lib/i18n/strings.g.dart
#	apps/app_seeds/lib/i18n/strings_ast.g.dart
This commit is contained in:
vjrj 2026-07-10 19:11:59 +02:00
commit 69f63d2b62
21 changed files with 972 additions and 107 deletions

View file

@ -0,0 +1,73 @@
import 'package:commons_core/commons_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tane/i18n/strings.g.dart';
import 'package:tane/services/social_service.dart';
import 'package:tane/services/social_settings.dart';
import 'package:tane/ui/market_offer_detail_screen.dart';
import '../support/test_support.dart';
Widget _wrap(MarketOfferDetailScreen screen) {
LocaleSettings.setLocaleSync(AppLocale.en);
return TranslationProvider(
child: MaterialApp(
locale: AppLocale.en.flutterLocale,
supportedLocales: AppLocaleUtils.supportedLocales,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
home: screen,
),
);
}
Offer _offer({bool organic = false}) => Offer(
id: 'lot-1',
authorPubkeyHex: 'ab' * 32,
summary: 'Tomate rosa de Barbastro',
type: OfferType.gift,
category: 'Solanaceae',
approxGeohash: 'sp3e9',
isOrganic: organic,
);
void main() {
testWidgets('renders the offer and a message button for a stranger',
(tester) async {
final social = await SocialService.fromRootSeedHex('00' * 32);
final settings = SocialSettings(InMemorySecretStore());
await settings.setRelayUrls(const []); // offline: no network in the test
await tester.pumpWidget(_wrap(MarketOfferDetailScreen(
offer: _offer(organic: true),
social: social,
settings: settings,
)));
await tester.pumpAndSettle();
expect(find.text('Tomate rosa de Barbastro'), findsWidgets);
expect(find.text('Solanaceae'), findsOneWidget);
expect(find.text('Organic'), findsOneWidget); // eco badge
expect(find.byKey(const Key('offerDetail.contact')), findsOneWidget);
});
testWidgets('hides the message button on my own listing', (tester) async {
final social = await SocialService.fromRootSeedHex('00' * 32);
final settings = SocialSettings(InMemorySecretStore());
await settings.setRelayUrls(const []);
await tester.pumpWidget(_wrap(MarketOfferDetailScreen(
offer: _offer(),
social: social,
settings: settings,
mine: true,
)));
await tester.pumpAndSettle();
expect(find.byKey(const Key('offerDetail.contact')), findsNothing);
});
}