Skip to content

Commit

Permalink
Ekran skanowania wyszukaj (#145)
Browse files Browse the repository at this point in the history
* add search.svg

* add Assets.search.svg

* fixes review

* add scan_search_button.dart

---------

Co-authored-by: Marcin Stepnowski <[email protected]>
  • Loading branch information
D3bi7 and WezSieTato authored Jan 16, 2025
1 parent 8a36114 commit 877f258
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 63 deletions.
3 changes: 3 additions & 0 deletions assets/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions lib/i18n/strings.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 1
/// Strings: 30
/// Strings: 31
///
/// Built on 2024-11-10 at 12:26 UTC
/// Built on 2025-01-12 at 20:22 UTC
// coverage:ignore-file
// ignore_for_file: type=lint
Expand Down Expand Up @@ -207,6 +207,7 @@ class _StringsScanEn {
String get lastScans => 'Ostatnie skany:';
String get error => 'Wystąpił błąd';
String get closeError => 'Zamknij.';
String get search => 'Wyszukaj';
}

/// Flat map(s) containing all translations.
Expand Down Expand Up @@ -245,6 +246,7 @@ extension on Translations {
case 'scan.lastScans': return 'Ostatnie skany:';
case 'scan.error': return 'Wystąpił błąd';
case 'scan.closeError': return 'Zamknij.';
case 'scan.search': return 'Wyszukaj';
default: return null;
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/strings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"wait": "Proszę czekać, trwa Ładowanie...",
"lastScans": "Ostatnie skany:",
"error": "Wystąpił błąd",
"closeError": "Zamknij."
"closeError": "Zamknij.",
"search": "Wyszukaj"
}

}
2 changes: 1 addition & 1 deletion lib/pages/detail/logotypes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Logotypes extends StatelessWidget {
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: AppColors.textField,
color: AppColors.textField.withAlpha((0.7 * 255).toInt()),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.3),
Expand Down
56 changes: 26 additions & 30 deletions lib/pages/scan/scan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:pola_flutter/pages/scan/companies_list.dart';
import 'package:pola_flutter/pages/scan/scan_background.dart';
import 'package:pola_flutter/pages/scan/scan_bloc.dart';
import 'package:pola_flutter/pages/scan/scan_event.dart';
import 'package:pola_flutter/pages/scan/scan_search_button.dart';
import 'package:pola_flutter/pages/scan/scan_state.dart';
import 'package:pola_flutter/i18n/strings.g.dart';
import 'package:pola_flutter/pages/scan/scan_vibration.dart';
Expand Down Expand Up @@ -71,19 +72,14 @@ class _MainPageState extends State<MainPage> {
children: <Widget>[
_buildQrView(context),
SafeArea(
child: Column(
children: <Widget>[
Center(
child: Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Text(
"Umieść kod kreskowy produktu w prostokącie powyżej aby dowiedzieć się więcej o firmie, która go wyprodukowała.",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
],
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 20.0, horizontal: 16.0),
child: Column(
children: <Widget>[
ScanSearchButton(),
],
),
),
),
SafeArea(
Expand Down Expand Up @@ -122,24 +118,24 @@ class _MainPageState extends State<MainPage> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: CompaniesList(state, listScrollController)),
Column(
children: [
GestureDetector(
onTap: () {
_scanBloc.add(ScanEvent.torchSwitched());
cameraController.toggleTorch();
},
child: Container(
decoration: BoxDecoration(
boxShadow: [],
),
child: state.isTorchOn
? Assets.scan.flashlightOn.svg()
: Assets.scan.flashlightOff.svg(),
child: CompaniesList(state, listScrollController),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: GestureDetector(
onTap: () {
_scanBloc.add(ScanEvent.torchSwitched());
cameraController.toggleTorch();
},
child: Container(
decoration: BoxDecoration(
boxShadow: [],
),
)
],
child: state.isTorchOn
? Assets.scan.flashlightOn.svg()
: Assets.scan.flashlightOff.svg(),
),
),
)
],
);
Expand Down
39 changes: 39 additions & 0 deletions lib/pages/scan/scan_search_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:pola_flutter/theme/assets.gen.dart';
import 'package:pola_flutter/theme/text_size.dart';
import 'package:pola_flutter/i18n/strings.g.dart';

class ScanSearchButton extends StatelessWidget {
const ScanSearchButton({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Center(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(25),
),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Assets.search.svg(),
),
Expanded(
child: Text(
t.scan.search,
style: TextStyle(
fontSize: TextSize.mediumTitle,
fontWeight: FontWeight.w400,
color: Colors.black,
),
),
),
],
),
),
);
}
}
33 changes: 4 additions & 29 deletions lib/theme/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 877f258

Please sign in to comment.