-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ekran skanowanie guzik dotacji #146
Open
D3bi7
wants to merge
9
commits into
feature/redesing
Choose a base branch
from
139-Ekran-skanowanie--Guzik-dotacji
base: feature/redesing
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8320a9b
add CloseRemoteButton in scan_bloc
D3bi7 abbc0a5
fixes review
D3bi7 264d305
add close_small.svg
D3bi7 700b944
Merge branch 'feature/redesing' into 139-Ekran-skanowanie--Guzik-dotacji
WezSieTato 88aca8a
Use bloc in remote button
WezSieTato 2069e63
Remove warning
WezSieTato 6a908ff
Add test for bloc and remote button
WezSieTato 0d65432
Add tests for closing
WezSieTato fb0d516
Formatowanie w testach
WezSieTato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,62 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:pola_flutter/analytics/pola_analytics.dart'; | ||
import 'package:pola_flutter/models/donate.dart'; | ||
import 'package:pola_flutter/theme/assets.gen.dart'; | ||
import 'package:pola_flutter/theme/colors.dart'; | ||
import 'package:url_launcher/url_launcher.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
|
||
class RemoteButtonState { | ||
final Donate? buttonDto; | ||
final String? code; | ||
class RemoteButtonState extends Equatable { | ||
final String title; | ||
final Uri uri; | ||
final String code; | ||
|
||
RemoteButtonState(this.buttonDto, this.code); | ||
RemoteButtonState({required this.title, required this.uri, required this.code}); | ||
|
||
@override | ||
List<Object?> get props => [title, uri, code]; | ||
} | ||
|
||
class RemoteButton extends StatelessWidget { | ||
RemoteButton(this.state); | ||
|
||
final RemoteButtonState state; | ||
final PolaAnalytics _analytics = PolaAnalytics.instance(); | ||
final GestureTapCallback onCloseTap; | ||
|
||
RemoteButton(this.state, this.onCloseTap); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Donate? buttonDto = state.buttonDto; | ||
String? code = state.code; | ||
if (buttonDto == null || buttonDto.showButton == false || code == null) { | ||
return Container(); | ||
} | ||
Uri? url = Uri.tryParse(buttonDto.url); | ||
if (url == null) { | ||
return Container(); | ||
} | ||
|
||
return Padding( | ||
padding: EdgeInsets.only(left: 8.0, top: 0.0, right: 8.0, bottom: 0.0), | ||
child: TextButton( | ||
style: ButtonStyle( | ||
fixedSize: WidgetStateProperty.all<Size>(Size(double.infinity, 0)), | ||
backgroundColor: WidgetStateProperty.all<Color>(Colors.red), | ||
foregroundColor: WidgetStateProperty.all<Color>(Colors.white), | ||
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), | ||
), | ||
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( | ||
onTap: onCloseTap, | ||
child: Assets.scan.closeSmall.svg(), | ||
), | ||
), | ||
onPressed: () async { | ||
_analytics.donateOpened(code); | ||
launchUrl( | ||
url, | ||
mode: LaunchMode.externalApplication, | ||
); | ||
}, | ||
child: Text(buttonDto.title), | ||
)); | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nie ustalamy ręcznie szerokości. Ustawiamy odpowiednio paddingi by reszta się sama dopasowała do ekranu.