Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
tibfox committed Sep 5, 2022
1 parent 3512063 commit 92bb4ac
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 203 deletions.
107 changes: 55 additions & 52 deletions lib/ui/pages/feeds/cards/PostListCardDesktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'package:dtube_go/ui/widgets/AccountAvatar.dart';
import 'package:dtube_go/utils/Navigation/navigationShortcuts.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:share_plus/share_plus.dart';
import 'package:video_player/video_player.dart';
import 'package:visibility_detector/visibility_detector.dart';
import 'package:youtube_player_iframe/youtube_player_iframe.dart';
Expand Down Expand Up @@ -647,55 +648,6 @@ class PostInfoBaseRow extends StatelessWidget {
foregroundColor: globalAlmostWhite,
elevation: 0.0,
children: [
// COMMENT BUTTON
SpeedDialChild(
child: ShadowedIcon(
visible: globals.keyPermissions.contains(4),
icon: FontAwesomeIcons.comment,
color: globalAlmostWhite,
shadowColor: Colors.black,
size: globalIconSizeBig),
foregroundColor: globalAlmostWhite,
elevation: 0,
backgroundColor: Colors.transparent,
onTap: () {
if (autoPauseVideoOnPopup) {
videoController.pause();
ytController.pause();
}
commentOpenCallback();

showDialog<String>(
context: context,
builder: (BuildContext context) =>
BlocProvider<UserBloc>(
create: (context) => UserBloc(
repository: UserRepositoryImpl()),
child: CommentDialog(
txBloc: BlocProvider.of<TransactionBloc>(
context),
originAuthor: feedItem.author,
originLink: feedItem.link,
defaultCommentVote: double.parse(
defaultCommentVotingWeight),
okCallback: () {
commentCloseCallback();
if (autoPauseVideoOnPopup) {
ytController.play();
videoController.play();
}
},
cancelCallback: () {
commentCloseCallback();
if (autoPauseVideoOnPopup) {
ytController.play();
videoController.play();
}
},
),
),
);
}),
// DOWNVOTE BUTTON
SpeedDialChild(
child: ShadowedIcon(
Expand All @@ -705,7 +657,7 @@ class PostInfoBaseRow extends StatelessWidget {
? globalAlmostWhite
: globalRed,
shadowColor: Colors.black,
size: globalIconSizeBig),
size: globalIconSizeMedium),
foregroundColor: globalAlmostWhite,
elevation: 0,
backgroundColor: Colors.transparent,
Expand Down Expand Up @@ -767,6 +719,57 @@ class PostInfoBaseRow extends StatelessWidget {
);
}
}),

// COMMENT BUTTON
SpeedDialChild(
child: ShadowedIcon(
visible: globals.keyPermissions.contains(4),
icon: FontAwesomeIcons.comment,
color: globalAlmostWhite,
shadowColor: Colors.black,
size: globalIconSizeMedium),
foregroundColor: globalAlmostWhite,
elevation: 0,
backgroundColor: Colors.transparent,
onTap: () {
if (autoPauseVideoOnPopup) {
videoController.pause();
ytController.pause();
}
commentOpenCallback();

showDialog<String>(
context: context,
builder: (BuildContext context) =>
BlocProvider<UserBloc>(
create: (context) => UserBloc(
repository: UserRepositoryImpl()),
child: CommentDialog(
txBloc: BlocProvider.of<TransactionBloc>(
context),
originAuthor: feedItem.author,
originLink: feedItem.link,
defaultCommentVote: double.parse(
defaultCommentVotingWeight),
okCallback: () {
commentCloseCallback();
if (autoPauseVideoOnPopup) {
ytController.play();
videoController.play();
}
},
cancelCallback: () {
commentCloseCallback();
if (autoPauseVideoOnPopup) {
ytController.play();
videoController.play();
}
},
),
),
);
}),

// UPVOTE BUTTON

SpeedDialChild(
Expand All @@ -777,7 +780,7 @@ class PostInfoBaseRow extends StatelessWidget {
? globalAlmostWhite
: globalRed,
shadowColor: Colors.black,
size: globalIconSizeBig),
size: globalIconSizeMedium),
foregroundColor: globalAlmostWhite,
elevation: 0,
backgroundColor: Colors.transparent,
Expand Down Expand Up @@ -847,7 +850,7 @@ class PostInfoBaseRow extends StatelessWidget {
icon: FontAwesomeIcons.gift,
color: globalAlmostWhite,
shadowColor: Colors.black,
size: globalIconSizeBig),
size: globalIconSizeMedium),
foregroundColor: globalAlmostWhite,
elevation: 0,
backgroundColor: Colors.transparent,
Expand Down
8 changes: 4 additions & 4 deletions lib/ui/pages/feeds/cards/PostListCardLarge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,8 @@ class PostInfoBaseRow extends StatelessWidget {
txBloc:
BlocProvider.of<TransactionBloc>(
context),
postBloc: BlocProvider.of<PostBloc>(
context),
postBloc: new PostBloc(
repository: PostRepositoryImpl()),
author: widget.author,
link: widget.link,
downvote: true,
Expand Down Expand Up @@ -742,8 +742,8 @@ class PostInfoBaseRow extends StatelessWidget {
widget.defaultPostVotingWeight),
defaultTip: double.parse(
widget.defaultPostVotingTip),
postBloc: BlocProvider.of<PostBloc>(
context),
postBloc: new PostBloc(
repository: PostRepositoryImpl()),
txBloc:
BlocProvider.of<TransactionBloc>(
context),
Expand Down
12 changes: 8 additions & 4 deletions lib/ui/pages/post/widgets/VotingDialog/VotingDialogDesktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ class _VotingDialogDesktopState extends State<VotingDialogDesktop> {
return true;
},
child: PopUpDialogWithTitleLogo(
titleWidgetPadding: 5.w,
titleWidgetSize: 20.w,
titleWidgetPadding: 25,
titleWidgetSize: 50,
height: 500,
width: 400,
callbackOK: () {},
titleWidget: FaIcon(
widget.downvote ? FontAwesomeIcons.flag : FontAwesomeIcons.heart,
Expand Down Expand Up @@ -127,7 +129,9 @@ class _VotingDialogDesktopState extends State<VotingDialogDesktop> {
children: [
Center(
child: Text(
"Voting",
widget.downvote && widget.fixedDownvoteActivated
? "Flagging"
: "Voting",
style: Theme.of(context).textTheme.headline1,
),
),
Expand All @@ -141,7 +145,7 @@ class _VotingDialogDesktopState extends State<VotingDialogDesktop> {
child: Column(
children: [
Text(
"Flagging this content will permanently hide it from your user interface." +
"Flagging this content will put a downvote on it and permanently hide it from your user interface." +
" If the curation team agrees it will get removed from the whole platform.",
style: Theme.of(context)
.textTheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class _VotingDialogMobileState extends State<VotingDialogMobile> {
callbackOK: () {},
titleWidget: FaIcon(
widget.downvote ? FontAwesomeIcons.flag : FontAwesomeIcons.heart,
size: 20.w,
size: 10.w,
color: widget.downvote ? globalRed : globalBGColor,
),
showTitleWidget: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/pages/search/Layouts/SearchScreenMobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class SearchScreenMobileState extends State<SearchScreenMobile> {
.bodyText1,
),
),
SizedBox(width: 15.w, child: _buildChips()),
SizedBox(width: 20.w, child: _buildChips()),
],
),
],
Expand Down
148 changes: 20 additions & 128 deletions lib/ui/widgets/Comments/CommentDialog.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import 'package:dtube_go/bloc/user/user_bloc_full.dart';
import 'package:dtube_go/ui/widgets/Comments/Layouts/CommentDialogDesktop.dart';
import 'package:dtube_go/ui/widgets/Comments/Layouts/CommentDialogMobile.dart';
import 'package:dtube_go/ui/widgets/DialogTemplates/DialogWithTitleLogo.dart';
import 'package:dtube_go/ui/widgets/Inputs/OverlayInputs.dart';
import 'package:dtube_go/ui/widgets/dtubeLogoPulse/dtubeLoading.dart';
import 'package:dtube_go/utils/Layout/ResponsiveLayout.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:responsive_sizer/responsive_sizer.dart';
import 'package:dtube_go/bloc/transaction/transaction_bloc_full.dart';
import 'package:dtube_go/style/ThemeData.dart';
import 'package:flutter/material.dart';

class CommentDialog extends StatefulWidget {
class CommentDialog extends StatelessWidget {
CommentDialog(
{Key? key,
required this.originAuthor,
Expand All @@ -26,135 +29,24 @@ class CommentDialog extends StatefulWidget {
final VoidCallback? okCallback;
final VoidCallback? cancelCallback;

@override
_CommentDialogState createState() => _CommentDialogState();
}

class _CommentDialogState extends State<CommentDialog> {
late TextEditingController _commentController;

late TransactionBloc _txBloc;
late UserBloc _userBloc;

@override
void initState() {
super.initState();

_commentController = new TextEditingController();
_userBloc = BlocProvider.of<UserBloc>(context);
_userBloc.add(FetchDTCVPEvent());

_txBloc = widget.txBloc;
}

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
if (widget.cancelCallback != null) {
widget.cancelCallback!();
}
return true;
},
child: PopUpDialogWithTitleLogo(
titleWidgetPadding: 5.w,
titleWidgetSize: 20.w,
callbackOK: () {},
titleWidget: FaIcon(
FontAwesomeIcons.comments,
size: 20.w,
color: globalBGColor,
),
showTitleWidget: true,
child: Builder(builder: (context) {
return BlocBuilder<UserBloc, UserState>(
bloc: _userBloc,
builder: (context, state) {
if (state is UserInitialState) {
return DtubeLogoPulseWithSubtitle(
subtitle: "loading your balance...", size: 30.w);
} else if (state is UserDTCVPLoadingState) {
return DtubeLogoPulseWithSubtitle(
subtitle: "loading your balance...", size: 30.w);
} else if (state is UserDTCVPLoadedState) {
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(
top: 1.h, bottom: 2.h, left: 2.w, right: 2.w),
child: OverlayTextInput(
autoFocus: true,
textEditingController: _commentController,
label: "New Comment",
),
),
InkWell(
child: Container(
padding: EdgeInsets.only(top: 20.0, bottom: 20.0),
decoration: BoxDecoration(
color: globalRed,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(20.0),
bottomRight: Radius.circular(20.0)),
),
child: Text(
"Send Comment",
style: Theme.of(context).textTheme.headline4,
textAlign: TextAlign.center,
),
),
onTap: () {
UploadData _uploadData = new UploadData(
link: "",
parentAuthor: widget.originAuthor,
parentPermlink: widget.originLink,
title: "",
description: _commentController.value.text,
tag: "",
vpPercent: widget.defaultCommentVote,
vpBalance: state.vtBalance['v']!,
burnDtc: 0,
dtcBalance:
0, // TODO promoted comment implementation missing
isPromoted: false,
duration: "",
thumbnailLocation: "",
localThumbnail: false,
videoLocation: "",
localVideoFile: false,
originalContent: false,
nSFWContent: false,
unlistVideo: false,
isEditing: false,
videoSourceHash: "",
video240pHash: "",
video480pHash: "",
videoSpriteHash: "",
thumbnail640Hash: "",
thumbnail210Hash: "",
uploaded: false,
crossPostToHive: false);

_txBloc.add(SendCommentEvent(_uploadData));
Navigator.of(context).pop();
if (widget.okCallback != null) {
widget.okCallback!();
}
}),
],
),
);
}
return DtubeLogoPulseWithSubtitle(
subtitle: "loading your balance...", size: 30.w);
},
);
}),
),
return ResponsiveLayout(
desktopBody: CommentDialogDesktop(
originAuthor: originAuthor,
txBloc: txBloc,
originLink: originLink,
defaultCommentVote: defaultCommentVote),
tabletBody: CommentDialogDesktop(
originAuthor: originAuthor,
txBloc: txBloc,
originLink: originLink,
defaultCommentVote: defaultCommentVote),
mobileBody: CommentDialogMobile(
originAuthor: originAuthor,
txBloc: txBloc,
originLink: originLink,
defaultCommentVote: defaultCommentVote),
);
}
}
Loading

0 comments on commit 92bb4ac

Please sign in to comment.