Skip to content

Commit

Permalink
fixes review
Browse files Browse the repository at this point in the history
  • Loading branch information
D3bi7 committed Sep 17, 2024
1 parent 52d8cd2 commit d569a6b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 73 deletions.
13 changes: 3 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,15 @@ class _PolaAppState extends State<PolaApp> {
body: IndexedStack(
index: _selectedIndex,
children: _tabs,
)
),
)),
),
);
}

final List<Widget> _tabs = [
MainPage(),
WebViewTab(
title: "Wyszukiwarka",
url: "https://www.pola-app.pl/m/search/"
),
WebViewTab(
title: "Wiadomości",
url: "https://www.pola-app.pl/m/blog/"
)
WebViewTab(title: "Wyszukiwarka", url: "https://www.pola-app.pl/m/search/"),
WebViewTab(title: "Wiadomości", url: "https://www.pola-app.pl/m/blog/")
];

AnalyticsMainTab _getTabParameter(int index) {
Expand Down
127 changes: 66 additions & 61 deletions lib/pages/scan/scan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,71 +87,75 @@ class _MainPageState extends State<MainPage> {
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.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),
),
),
),
],
),
),
SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Spacer(),
BlocBuilder<ScanBloc, ScanState>(
bloc: _scanBloc,
builder: (context, state) {
if (state.isError) {
SchedulerBinding.instance.addPostFrameCallback((_) {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) {
return AlertDialog(
title: Text('Wystąpił błąd'),
content: Text(
'Niestety nie udało się pobrać danych. Spróbuj ponownie.'),
actions: <Widget>[
TextButton(
child: Text('Zamknij.'),
onPressed: () {
_scanBloc
.add(ScanEvent.alertDialogDismissed());
SchedulerBinding.instance
.addPostFrameCallback((_) {
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Spacer(),
BlocBuilder<ScanBloc, ScanState>(
bloc: _scanBloc,
builder: (context, state) {
if (state.isError) {
SchedulerBinding.instance.addPostFrameCallback((_) {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Wystąpił błąd'),
content: Text(
'Niestety nie udało się pobrać danych. Spróbuj ponownie.'),
actions: <Widget>[
TextButton(
child: Text('Zamknij.'),
onPressed: () {
_scanBloc
.add(ScanEvent.alertDialogDismissed());
Navigator.pop(context);
});
},
),
],
);
},
);
});
}
return CompaniesList(state, listScrollController);
},
),
],
)),
},
),
],
);
},
);
});
}
return CompaniesList(state, listScrollController);
},
),
],
),
),
Positioned(
bottom: 20,
right: 20,
bottom: 35,
right: 5,
child: GestureDetector(
onTap: () {
setState(() {
_isTorchOn = !_isTorchOn;
cameraController.toggleTorch();
});
},
child: _isTorchOn
? Assets.menuPage.flashlighton.svg()
: Assets.menuPage.flashlightoff.svg(),
child: Container(
decoration: BoxDecoration(
boxShadow: [],
),
child: _isTorchOn
? Assets.menuPage.flashlighton.svg()
: Assets.menuPage.flashlightoff.svg(),
),
),
),
],
Expand All @@ -169,15 +173,16 @@ class _MainPageState extends State<MainPage> {
children: [
Positioned.fill(
child: MobileScanner(
controller: cameraController,
onDetect: (capture) {
final List<Barcode> barcodes = capture.barcodes;
for (final barcode in barcodes) {
final String code = barcode.rawValue!;
debugPrint('Barcode found! $code');
_scanBloc.add(ScanEvent.barcodeScanned(code));
}
}),
controller: cameraController,
onDetect: (capture) {
final List<Barcode> barcodes = capture.barcodes;
for (final barcode in barcodes) {
final String code = barcode.rawValue!;
debugPrint('Barcode found! $code');
_scanBloc.add(ScanEvent.barcodeScanned(code));
}
},
),
),
Positioned.fill(
child: Align(
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ class _ListItem extends StatelessWidget {
Expanded(child: child),
Padding(
padding: EdgeInsets.only(right: 8.0),
child: Assets.menuPage.showmore.svg(
),
child: Assets.menuPage.showmore.svg(),
),
],
),
Expand Down

0 comments on commit d569a6b

Please sign in to comment.