-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fetch image #229
Fetch image #229
Changes from 8 commits
828d1da
edcb52d
d798883
b73c3ab
3c86637
aab6921
0fe5a0b
a038a82
6d87963
902f0e9
c4ca98f
bf2994c
677bb8f
3334da6
f65fa38
0f6d86f
5b4b53c
e9fe430
4c8894a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,6 @@ app.*.map.json | |
/android/app/debug | ||
/android/app/profile | ||
/android/app/release | ||
|
||
# env variables and secrets | ||
*.env |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
import 'package:ipfs_client_flutter/ipfs_client_flutter.dart'; | ||
|
||
class IPFSManager { | ||
final serverUlr = 'https://ipfs.infura.io:5001'; | ||
late IpfsClient ipfsClient; | ||
|
||
IPFSManager() { | ||
final apiKeySecret = dotenv.env['IPFS_API_KEY_SECRET']; | ||
ipfsClient = IpfsClient(url: serverUlr, authorizationToken: apiKeySecret); | ||
} | ||
|
||
Future getImage(String imageToken) async { | ||
final response = await ipfsClient.read(dir: imageToken); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @n13 this doesnt work. it fail. can you take a look when you get some time pls. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm |
||
return response; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:hypha_wallet/core/network/models/dao_data_model.dart'; | ||
import 'package:hypha_wallet/design/dividers/hypha_divider.dart'; | ||
import 'package:hypha_wallet/design/hypha_card.dart'; | ||
import 'package:hypha_wallet/design/hypha_colors.dart'; | ||
import 'package:hypha_wallet/design/themes/extensions/theme_extension_provider.dart'; | ||
|
||
class DaoWidget extends StatelessWidget { | ||
|
@@ -13,54 +15,71 @@ class DaoWidget extends StatelessWidget { | |
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 22), | ||
child: HyphaCard( | ||
child: InkWell( | ||
borderRadius: BorderRadius.circular(16), | ||
onTap: () {}, | ||
child: Padding( | ||
padding: const EdgeInsets.only(left: 22, right: 22, top: 12, bottom: 22), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
ListTile( | ||
dense: true, | ||
// leading: FutureBuilder<String>( | ||
// future: fetchSVGFromIPFS('QmV3KmaoqCCXuCDvHzYWS9Jg3RfjrDTQSXK1e7453qfSRS'), | ||
// builder: (context, snapshot) { | ||
// if (snapshot.connectionState == ConnectionState.waiting) { | ||
// return CircularProgressIndicator(); | ||
// } else if (snapshot.hasError) { | ||
// return Text('Error: ${snapshot.error}'); | ||
// } else { | ||
// return SvgPicture.string(snapshot.data!); | ||
// } | ||
// }, | ||
// ), | ||
visualDensity: VisualDensity.compact, | ||
title: Text(dao.settingsDaoTitle, style: context.hyphaTextTheme.smallTitles), | ||
), | ||
// const SizedBox(height: 14), | ||
// const HyphaDivider(), | ||
// const SizedBox(height: 20), | ||
], | ||
return HyphaCard( | ||
child: InkWell( | ||
borderRadius: BorderRadius.circular(16), | ||
onTap: () { | ||
/// Navigate to Hypha URL | ||
}, | ||
child: Stack( | ||
children: [ | ||
const Positioned( | ||
right: 12, | ||
top: 12, | ||
child: Icon(Icons.navigate_next), | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(24), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: [ | ||
const Icon(Icons.ac_unit, size: 48), | ||
const SizedBox(width: 8), | ||
Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text(dao.settingsDaoTitle, style: context.hyphaTextTheme.smallTitles), | ||
Text( | ||
'dao.hypha.earth/${dao.settingsDaoUrl}', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought this field was called short URL or something |
||
style: context.hyphaTextTheme.reducedTitles.copyWith(color: HyphaColors.primaryBlu), | ||
), | ||
], | ||
) | ||
], | ||
), | ||
const SizedBox(height: 12), | ||
const HyphaDivider(), | ||
const SizedBox(height: 12), | ||
Row( | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Row( | ||
children: [ | ||
const Icon(Icons.calendar_month), | ||
const SizedBox(width: 4), | ||
Text( | ||
'The date here', | ||
n13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
style: context.hyphaTextTheme.ralMediumSmallNote.copyWith( | ||
height: 0, | ||
color: HyphaColors.midGrey, | ||
), | ||
), | ||
], | ||
), | ||
Text('Core member', style: context.hyphaTextTheme.ralMediumBody.copyWith(height: 0)), | ||
], | ||
) | ||
], | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
// Future<String> fetchSVGFromIPFS(String ipfsHash) async { | ||
// final ipfsURL = 'https://ipfs.io/ipfs/$ipfsHash:svg'; | ||
// final response = await http.get(Uri.parse(ipfsURL)); | ||
// | ||
// if (response.statusCode == 200) { | ||
// return response.body; | ||
// } else { | ||
// throw Exception('Failed to fetch SVG from IPFS. Status code: ${response.statusCode}'); | ||
// } | ||
// } |
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.
Ok... guess we need secret - let's load it from firebase?! At least it won't be in the code then..