Skip to content

Commit

Permalink
review in remote button
Browse files Browse the repository at this point in the history
  • Loading branch information
D3bi7 committed Mar 6, 2025
1 parent c94ba03 commit 20dbafc
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 40 deletions.
6 changes: 4 additions & 2 deletions lib/pages/scan/companies_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import 'package:pola_flutter/ui/list_item.dart';
import 'dart:math';

class CompaniesList extends StatelessWidget {
CompaniesList(this.state, this.listScrollController, this.onCloseRemoteButtonTap);
CompaniesList(
this.state, this.listScrollController, this.onCloseRemoteButtonTap);

final ScanState state;
final ScrollController listScrollController;
Expand Down Expand Up @@ -53,7 +54,8 @@ class CompaniesList extends StatelessWidget {
),
),
),
if (state.remoteButtonState != null) RemoteButton(state.remoteButtonState!, onCloseRemoteButtonTap),
if (state.remoteButtonState != null)
RemoteButton(state.remoteButtonState!, onCloseRemoteButtonTap),
],
);
}
Expand Down
51 changes: 27 additions & 24 deletions lib/pages/scan/remote_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ class RemoteButtonState extends Equatable {
final Uri uri;
final String code;

RemoteButtonState({required this.title, required this.uri, required this.code});
RemoteButtonState(
{required this.title, required this.uri, required this.code});

@override
@override
List<Object?> get props => [title, uri, code];
}

Expand All @@ -25,37 +26,39 @@ class RemoteButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: 328,
height: 40,
decoration: BoxDecoration(
color: AppColors.defaultRed,
borderRadius: BorderRadius.circular(25),
),
child: Row(
children: [
Expanded(
child: TextButton(
style: ButtonStyle(
foregroundColor: WidgetStateProperty.all<Color>(Colors.white),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 11.0),
child: Row(
children: [
Expanded(
child: TextButton(
style: ButtonStyle(
foregroundColor: WidgetStateProperty.all<Color>(Colors.white),
),
onPressed: () async {
PolaAnalytics.instance().donateOpened(state.code);
await launchUrl(
state.uri,
mode: LaunchMode.externalApplication,
);
},
child: Text(state.title),
),
onPressed: () async {
PolaAnalytics.instance().donateOpened(state.code);
await launchUrl(
state.uri,
mode: LaunchMode.externalApplication,
);
},
child: Text(state.title),
),
),
Container(
margin: const EdgeInsets.only(right: 8.0),
child: GestureDetector(
GestureDetector(
onTap: onCloseTap,
child: Assets.scan.closeSmall.svg(),
child: Container(
padding: const EdgeInsets.all(8.0),
child: Assets.scan.closeSmall.svg(),
),
),
),
],
],
),
),
);
}
Expand Down
36 changes: 22 additions & 14 deletions lib/pages/scan/scan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:pola_flutter/analytics/pola_analytics.dart';
import 'package:pola_flutter/data/pola_api_repository.dart';
import 'package:pola_flutter/pages/scan/companies_list.dart';
import 'package:pola_flutter/pages/scan/remote_button.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';
Expand Down Expand Up @@ -115,26 +116,33 @@ class _MainPageState extends State<MainPage> {
);
});
}
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child:
CompaniesList(state, listScrollController, () {
_scanBloc.add(ScanEvent.closeRemoteButton());
})),
Column(
children: [

return Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: CompaniesList(state, listScrollController,
() {
_scanBloc.add(ScanEvent.closeRemoteButton());
})),
Column(
children: [
TorchButton(
isTorchOn: state.isTorchOn,
onTap: () {
_scanBloc.add(ScanEvent.torchSwitched());
},
)
],
)
],
);
],
)
],
),
if (state.remoteButtonState != null)
RemoteButton(state.remoteButtonState!, () {
_scanBloc.add(ScanEvent.closeRemoteButton());
})
]);
},
),
],
Expand Down

0 comments on commit 20dbafc

Please sign in to comment.