-
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 #13 from NiklasLehnfeld/feature/redesign
Redesign of Article list entry
- Loading branch information
Showing
25 changed files
with
565 additions
and
236 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:netzpolitik_mobile/models/article.dart'; | ||
import 'package:netzpolitik_mobile/extensions/string_ext.dart'; | ||
|
||
extension ArticleExteinsions on Article { | ||
|
||
bool get hasMp3 => content?.containsMP3 ?? false; | ||
|
||
String? get mp3Url => content?.mp3Url; | ||
|
||
} |
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 |
---|---|---|
|
@@ -50,4 +50,8 @@ class RatingManager { | |
} | ||
} | ||
|
||
void openStore() async { | ||
await _inAppReview.openStoreListing(); | ||
} | ||
|
||
} |
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 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
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,57 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; | ||
import 'package:netzpolitik_mobile/extensions/context_ext.dart'; | ||
import 'package:netzpolitik_mobile/models/article.dart'; | ||
import 'package:netzpolitik_mobile/persistence/article_dao.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
class BookmarkButtonWidget extends StatefulWidget { | ||
|
||
final Article article; | ||
final bool hasPadding; | ||
final Color? color; | ||
|
||
const BookmarkButtonWidget(this.article, {this.hasPadding = true, this.color}); | ||
|
||
@override | ||
State<BookmarkButtonWidget> createState() => _BookmarkButtonWidgetState(); | ||
} | ||
|
||
class _BookmarkButtonWidgetState extends State<BookmarkButtonWidget> { | ||
|
||
bool _bookmarked = false; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final dao = context.watch<ArticleDAO>(); | ||
|
||
return FutureBuilder<bool>( | ||
future: dao.isStored(widget.article), | ||
builder: (context, snapshot) { | ||
|
||
if (snapshot.hasData && snapshot.data != null) { | ||
_bookmarked = snapshot.data!; | ||
} | ||
|
||
return IconButton( | ||
padding: widget.hasPadding ? EdgeInsets.all(8.0) : EdgeInsets.zero, | ||
constraints: widget.hasPadding ? null : BoxConstraints(), | ||
icon: FaIcon( | ||
_bookmarked ? FontAwesomeIcons.solidBookmark : FontAwesomeIcons.bookmark, | ||
color: widget.color ?? context.iconButtonColor, | ||
), | ||
onPressed: () async { | ||
if (_bookmarked) { | ||
await dao.delete(widget.article.id!); | ||
} else { | ||
await dao.insert(widget.article); | ||
} | ||
setState(() { | ||
_bookmarked = !_bookmarked; | ||
}); | ||
}, | ||
); | ||
} | ||
); | ||
} | ||
} |
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,38 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; | ||
import 'package:netzpolitik_mobile/extensions/context_ext.dart'; | ||
import 'package:netzpolitik_mobile/models/article.dart'; | ||
import 'package:share/share.dart'; | ||
|
||
class ShareButtonWidget extends StatelessWidget { | ||
|
||
final Article article; | ||
final bool hasPadding; | ||
final Color? color; | ||
|
||
const ShareButtonWidget(this.article, {this.hasPadding = true, this.color}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
var url = article.link; | ||
|
||
if (url == null) { | ||
return Container(); | ||
} | ||
|
||
return IconButton( | ||
padding: hasPadding ? EdgeInsets.all(8.0) : EdgeInsets.zero, | ||
constraints: hasPadding ? null : BoxConstraints(), | ||
icon: FaIcon( | ||
FontAwesomeIcons.shareAlt, | ||
color: color ?? context.iconButtonColor, | ||
), | ||
onPressed: () async { | ||
await Share.share(url); | ||
}, | ||
); | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.