Broken heart displayed when offline + theme fixes to message view #48

Merged
erinn merged 1 commits from message_pane_ui into trunk 2021-04-14 20:28:49 +00:00
6 changed files with 143 additions and 65 deletions

View File

@ -1,13 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;}
</style>
<path class="st0" d="M0,0h24v24H0V0z"/>
<path id="Subtraction_1" d="M18.5,16L18.5,16L5.3,4.4C6.3,3.5,7.6,3,9,3c1.7,0,3.3,0.7,4.4,2c1.1-1.3,2.7-2,4.4-2
C20.6,3,23,5.3,23,8.2c0,0,0,0.1,0,0.1c0,0.6-0.1,1.3-0.3,1.9c-0.2,0.7-0.5,1.3-0.9,1.9C21.1,13.2,20.1,14.4,18.5,16L18.5,16z"/>
<path d="M20.2,18.6L2.3,3.1L1,4.6l2.6,2.2C3.2,7.5,3,8.4,3,9.2c0,3.7,3.3,6.6,8.3,11.2l1.4,1.3l1.4-1.3c0.9-0.8,1.7-1.6,2.5-2.3
l2.3,2L20.2,18.6z"/>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 24.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 24 24"
style="enable-background:new 0 0 24 24;"
xml:space="preserve"
sodipodi:docname="negative_heart_24px.svg"
inkscape:export-filename="/home/sarah/AndroidStudioProjects/flutter_app/assets/core/negative_heart_512px.png"
inkscape:export-xdpi="4096"
inkscape:export-ydpi="4096"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata
id="metadata14"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs12" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1015"
id="namedview10"
showgrid="false"
inkscape:zoom="9.8333333"
inkscape:cx="12"
inkscape:cy="14.687942"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" />
<style
type="text/css"
id="style2">
.st0{fill:none;}
</style>
<g
id="g824"
transform="translate(4.0677965,4.0677965)"><path
style="fill:none;stroke-width:0.66101694"
inkscape:connector-curvature="0"
id="path4"
d="M 0,0 H 15.864407 V 15.864407 H 0 Z"
class="st0" /><path
style="stroke-width:0.66101694"
inkscape:connector-curvature="0"
d="m 12.228814,10.576271 v 0 L 3.5033898,2.9084746 c 0.661017,-0.5949153 1.520339,-0.9254238 2.4457627,-0.9254238 1.1237289,0 2.181356,0.4627119 2.9084746,1.3220339 0.7271187,-0.859322 1.7847459,-1.3220339 2.9084749,-1.3220339 1.850847,0 3.437288,1.520339 3.437288,3.4372882 0,0 0,0.066102 0,0.066102 0,0.3966101 -0.0661,0.859322 -0.198305,1.2559322 -0.132204,0.4627118 -0.330509,0.859322 -0.594916,1.2559322 -0.462711,0.7271186 -1.123728,1.520339 -2.181355,2.5779656 z"
id="Subtraction_1" /><path
style="stroke-width:0.66101694"
inkscape:connector-curvature="0"
id="path7"
d="M 13.352542,12.294915 1.520339,2.0491525 0.66101695,3.040678 2.379661,4.4949153 C 2.1152542,4.9576271 1.9830508,5.5525424 1.9830508,6.0813559 c 0,2.4457627 2.181356,4.3627121 5.4864407,7.4033901 l 0.9254238,0.859322 0.9254237,-0.859322 c 0.5949152,-0.528814 1.123729,-1.057627 1.652542,-1.520339 l 1.520339,1.322034 z" /></g>
</svg>

Before

Width:  |  Height:  |  Size: 840 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
import '../main.dart';
import '../model.dart';
import '../opaque.dart';
import '../settings.dart';
import '../widgets/messagelist.dart';
class MessageView extends StatefulWidget {
@ -87,7 +88,7 @@ class _MessageViewState extends State<MessageView> {
Widget _buildComposeBox() {
return Container(
color: Opaque.current().backgroundMainColor(),
color: Provider.of<Settings>(context).theme.backgroundMainColor(),
height: 100,
padding: EdgeInsets.all(8.0),
child: Row(
@ -106,10 +107,10 @@ class _MessageViewState extends State<MessageView> {
Padding(
padding: EdgeInsets.fromLTRB(2, 2, 2, 2),
child: ElevatedButton(
child: Icon(Icons.send, color: Opaque.current().mainTextColor()),
child: Icon(Icons.send, color: Provider.of<Settings>(context).theme.mainTextColor()),
style: ButtonStyle(
fixedSize: MaterialStateProperty.all(Size(86, 40)),
backgroundColor: MaterialStateProperty.all(Opaque.current().defaultButtonColor()),
backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.defaultButtonColor()),
),
onPressed: _sendMessage,
)),
@ -119,10 +120,10 @@ class _MessageViewState extends State<MessageView> {
child: SizedBox(
width: 41,
child: ElevatedButton(
child: Icon(Icons.emoji_emotions_outlined, color: Opaque.current().mainTextColor()),
child: Icon(Icons.emoji_emotions_outlined, color: Provider.of<Settings>(context).theme.mainTextColor()),
style: ButtonStyle(
fixedSize: MaterialStateProperty.all(Size(41, 40)),
backgroundColor: MaterialStateProperty.all(Opaque.current().defaultButtonColor()),
backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.defaultButtonColor()),
),
onPressed: placeHolder,
))),
@ -131,10 +132,10 @@ class _MessageViewState extends State<MessageView> {
child: SizedBox(
width: 41,
child: ElevatedButton(
child: Icon(Icons.attach_file, color: Opaque.current().mainTextColor()),
child: Icon(Icons.attach_file, color: Provider.of<Settings>(context).theme.mainTextColor()),
style: ButtonStyle(
fixedSize: MaterialStateProperty.all(Size(41, 40)),
backgroundColor: MaterialStateProperty.all(Opaque.current().defaultButtonColor()),
backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.defaultButtonColor()),
),
onPressed: placeHolder,
))),

View File

@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../model.dart';
import '../opaque.dart';
import 'package:intl/intl.dart';
import '../settings.dart';
class MessageBubble extends StatefulWidget {
@override
_MessageBubbleState createState() => _MessageBubbleState();
@ -21,28 +22,40 @@ class _MessageBubbleState extends State<MessageBubble> {
prettyDate = DateFormat.yMd().add_jm().format(Provider.of<MessageState>(context).timestamp);
}
return Container(
decoration: BoxDecoration(
color: fromMe ? Opaque.current().messageFromMeBackgroundColor() : Opaque.current().messageFromOtherBackgroundColor(),
border: Border.all(color: fromMe ? Opaque.current().messageFromMeBackgroundColor() : Opaque.current().messageFromOtherBackgroundColor(), width: 1),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(borderRadiousEh),
topRight: Radius.circular(borderRadiousEh),
bottomLeft: fromMe ? Radius.circular(borderRadiousEh) : Radius.zero,
bottomRight: fromMe ? Radius.zero : Radius.circular(borderRadiousEh),
),
decoration: BoxDecoration(
color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor() : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor(),
border: Border.all(color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor() : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor(), width: 1),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(borderRadiousEh),
topRight: Radius.circular(borderRadiousEh),
bottomLeft: fromMe ? Radius.circular(borderRadiousEh) : Radius.zero,
bottomRight: fromMe ? Radius.zero : Radius.circular(borderRadiousEh),
),
child: Padding(padding: EdgeInsets.all(9.0), child:Column(crossAxisAlignment: fromMe ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [SelectableText(
Provider.of<MessageState>(context).message,
textAlign: TextAlign.left,
),
Row(
children: [
Text(prettyDate, style: TextStyle(fontSize: 9.0), textAlign: fromMe ? TextAlign.right : TextAlign.left),
Provider.of<MessageState>(context).ackd
? Icon(Icons.check_circle_outline, color: Opaque.current().mainTextColor(), size: 12)
: Icon(Icons.hourglass_bottom_outlined, color: Opaque.current().mainTextColor(), size: 12)
],
)])),
),
child: Padding(
padding: EdgeInsets.all(9.0),
child: Column(crossAxisAlignment: fromMe ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [
SelectableText(
Provider.of<MessageState>(context).message,
style: TextStyle(
color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor() : Provider.of<Settings>(context).theme.messageFromOtherTextColor(),
),
textAlign: TextAlign.left,
),
Row(
children: [
Text(prettyDate,
style: TextStyle(
fontSize: 9.0,
color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor() : Provider.of<Settings>(context).theme.messageFromOtherTextColor(),
),
textAlign: fromMe ? TextAlign.right : TextAlign.left),
Provider.of<MessageState>(context).ackd
? Icon(Icons.check_circle_outline, color: Provider.of<Settings>(context).theme.messageFromMeTextColor(), size: 12)
: Icon(Icons.hourglass_bottom_outlined, color: Provider.of<Settings>(context).theme.messageFromMeTextColor(), size: 12)
],
)
])),
);
}
}

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../model.dart';
import 'messagebubble.dart';
import '../settings.dart';
import 'messagerow.dart';
class MessageList extends StatefulWidget {
@ -43,22 +43,31 @@ class _MessageListState extends State<MessageList> {
WidgetsBinding.instance.addPostFrameCallback((_) => _scrollToBottom(false));
return Card(
child: Scrollbar(
isAlwaysShown: true,
controller: ctrlr1,
child: ListView.builder(
controller: ctrlr1,
itemCount: Provider.of<ContactInfoState>(context).totalMessages,
itemBuilder: (context, index) {
return ChangeNotifierProvider(
create: (_) => MessageState(
context: context,
profileOnion: Provider.of<ProfileInfoState>(outerContext).onion,
contactHandle: Provider.of<ContactInfoState>(outerContext).onion,
messageIndex: index,
),
child: MessageRow());
},
),
));
isAlwaysShown: true,
controller: ctrlr1,
child: Container(
// Only show broken heart is the contact is offline...
decoration: Provider.of<ContactInfoState>(outerContext).status == "Authenticated"
? null
: BoxDecoration(
image: DecorationImage(
fit: BoxFit.contain,
image: AssetImage("assets/core/negative_heart_512px.png"),
colorFilter: ColorFilter.mode(Provider.of<Settings>(context).theme.mainTextColor(), BlendMode.srcIn))),
child: ListView.builder(
controller: ctrlr1,
itemCount: Provider.of<ContactInfoState>(context).totalMessages,
itemBuilder: (context, index) {
return ChangeNotifierProvider(
create: (_) => MessageState(
context: context,
profileOnion: Provider.of<ProfileInfoState>(outerContext).onion,
contactHandle: Provider.of<ContactInfoState>(outerContext).onion,
messageIndex: index,
),
child: MessageRow());
},
),
)));
}
}

View File

@ -5,7 +5,6 @@ import 'package:provider/provider.dart';
import '../main.dart';
import '../model.dart';
import '../opaque.dart';
import '../settings.dart';
import 'messagebubble.dart';
@ -20,8 +19,8 @@ class _MessageRowState extends State<MessageRow> {
var fromMe = Provider.of<MessageState>(context).senderOnion == Provider.of<ProfileInfoState>(context).onion;
Widget wdgBubble = MessageBubble();
Widget wdgIcons = Icon(Icons.delete_forever_outlined, color: Opaque.current().dropShadowColor());
Widget wdgSpacer = Expanded(child:SizedBox(width: 60, height: 10));
Widget wdgIcons = Icon(Icons.delete_forever_outlined, color: Provider.of<Settings>(context).theme.dropShadowColor());
Widget wdgSpacer = Expanded(child: SizedBox(width: 60, height: 10));
var widgetRow = <Widget>[];
if (fromMe) {
@ -36,8 +35,7 @@ class _MessageRowState extends State<MessageRow> {
diameter: 48.0,
imagePath: contact.imagePath,
maskOut: contact.status != "Authenticated",
border: contact.status == "Authenticated" ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor() : Provider.of<Settings>(context).theme.portraitOfflineBorderColor()
);
border: contact.status == "Authenticated" ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor() : Provider.of<Settings>(context).theme.portraitOfflineBorderColor());
widgetRow = <Widget>[
wdgPortrait,