-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from kackogut/feature/token_picker
Feature/token picker
- Loading branch information
Showing
28 changed files
with
465 additions
and
111 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class TokenResponse { | ||
TokenResponse({ | ||
required this.id, | ||
required this.imageUrl, | ||
required this.symbol, | ||
this.address, | ||
}); | ||
|
||
final String id; | ||
final String symbol; | ||
final String? address; | ||
final String imageUrl; | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'spl_token.dart'; | ||
|
||
abstract class TokensRepository { | ||
List<TokenResponse> getTokens(); | ||
} | ||
|
||
class LocalTokensRepository extends TokensRepository { | ||
@override | ||
List<TokenResponse> getTokens() => [ | ||
TokenResponse( | ||
id: "1", | ||
symbol: "SOL", | ||
address: null, | ||
imageUrl: | ||
"https://upload.wikimedia.org/wikipedia/en/b/b9/Solana_logo.png", | ||
), | ||
TokenResponse( | ||
id: "2", | ||
symbol: "USDC", | ||
address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", | ||
imageUrl: | ||
"https://s2.coinmarketcap.com/static/img/coins/200x200/3408.png", | ||
) | ||
]; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
class TokenPickerListItem extends StatelessWidget { | ||
final String _imageUrl; | ||
final String _symbol; | ||
|
||
const TokenPickerListItem({super.key, required imageUrl, required symbol}) | ||
: _imageUrl = imageUrl, | ||
_symbol = symbol; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
children: [ | ||
Image.network( | ||
_imageUrl, | ||
width: 32, | ||
height: 32, | ||
), | ||
const Padding(padding: EdgeInsets.all(8)), | ||
Text(_symbol), | ||
], | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:sol_pay_gen/data/token/tokens_repository.dart'; | ||
import 'package:sol_pay_gen/domain/token/spl_token_data.dart'; | ||
import 'package:sol_pay_gen/domain/token/spl_token_mapper.dart'; | ||
|
||
class GetTokensUseCase { | ||
GetTokensUseCase(this._tokensRepository); | ||
|
||
final TokensRepository _tokensRepository; | ||
|
||
List<TokenData> execute() { | ||
return _tokensRepository | ||
.getTokens() | ||
.map((tokenResponse) => tokenResponse.toDomainModel()) | ||
.toList(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class TokenData { | ||
TokenData({ | ||
required this.id, | ||
required this.imageUrl, | ||
required this.symbol, | ||
this.address, | ||
}); | ||
|
||
final String id; | ||
final String symbol; | ||
final String? address; | ||
final String imageUrl; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:sol_pay_gen/data/token/spl_token.dart'; | ||
import 'package:sol_pay_gen/domain/token/spl_token_data.dart'; | ||
|
||
extension TokenMapper on TokenResponse { | ||
TokenData toDomainModel() { | ||
return TokenData( | ||
id: id, | ||
imageUrl: imageUrl, | ||
symbol: symbol, | ||
address: address, | ||
); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...enerate_transfer_request_qr_use_case.dart → ...enerate_transfer_request_qr_use_case.dart
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.