This commit is contained in:
Salvatore Giordano
2020-11-05 15:27:32 +01:00
parent 38fb946071
commit d51584e3ca
+38 -61
View File
@@ -231,46 +231,44 @@ class MessageInputState extends State<MessageInput> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Center( Container(
child: Container( height: 16,
height: 16, width: 16,
width: 16, foregroundDecoration: BoxDecoration(
foregroundDecoration: BoxDecoration( border: _sendAsDm
border: _sendAsDm ? null
? null : Border.all(
: Border.all( color: Colors.black.withOpacity(.5),
color: Colors.black.withOpacity(.5), width: 2,
width: 2, ),
), borderRadius: BorderRadius.circular(3),
),
child: Center(
child: Material(
borderRadius: BorderRadius.circular(3), borderRadius: BorderRadius.circular(3),
), color: _sendAsDm
child: Center( ? StreamChatTheme.of(context).accentColor
child: Material( : Colors.white,
borderRadius: BorderRadius.circular(3), child: InkWell(
color: _sendAsDm onTap: () {
? StreamChatTheme.of(context).accentColor setState(() {
: Colors.white, _sendAsDm = !_sendAsDm;
child: InkWell( });
onTap: () { },
setState(() { child: AnimatedCrossFade(
_sendAsDm = !_sendAsDm; duration: Duration(milliseconds: 300),
}); reverseDuration: Duration(milliseconds: 300),
}, crossFadeState: _sendAsDm
child: AnimatedCrossFade( ? CrossFadeState.showFirst
duration: Duration(milliseconds: 300), : CrossFadeState.showSecond,
reverseDuration: Duration(milliseconds: 300), firstChild: Icon(
crossFadeState: _sendAsDm StreamIcons.check,
? CrossFadeState.showFirst size: 16.0,
: CrossFadeState.showSecond, color: Colors.white,
firstChild: Icon( ),
StreamIcons.check, secondChild: SizedBox(
size: 16.0, height: 16,
color: Colors.white, width: 16,
),
secondChild: SizedBox(
height: 16,
width: 16,
),
), ),
), ),
), ),
@@ -278,33 +276,12 @@ class MessageInputState extends State<MessageInput> {
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text('Send also as direct message'), child: Text('Send also as direct message'),
), ),
], ],
), ),
); );
return Row(
children: [
ClipRRect(
clipBehavior: Clip.hardEdge,
borderRadius: BorderRadius.circular(1),
child: Checkbox(
value: _sendAsDm,
onChanged: (val) => setState(
() {
_sendAsDm = val;
},
),
activeColor: StreamChatTheme.of(context).accentColor,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text('Send also as direct message'),
),
],
);
} }
AnimatedCrossFade _animateSendButton(BuildContext context) { AnimatedCrossFade _animateSendButton(BuildContext context) {