feat: Added text theme instead of hardcoded styles

This commit is contained in:
Deven Joshi
2020-12-28 15:29:29 +05:30
parent 934167c8b7
commit b58d00a5f0
10 changed files with 58 additions and 69 deletions
+5 -5
View File
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart'; import 'package:jiffy/jiffy.dart';
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
/// It shows a date divider depending on the date difference /// It shows a date divider depending on the date difference
class DateDivider extends StatelessWidget { class DateDivider extends StatelessWidget {
@@ -49,11 +50,10 @@ class DateDivider extends StatelessWidget {
), ),
child: Text( child: Text(
dayInfo, dayInfo,
style: TextStyle( style: StreamChatTheme.of(context).textTheme.footnoteBold.copyWith(
fontSize: 12, color: Colors.white,
color: Colors.white, fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, ),
),
), ),
), ),
); );
+5 -8
View File
@@ -88,10 +88,7 @@ class _FileAttachmentState extends State<FileAttachment> {
children: [ children: [
Text( Text(
widget.attachment?.title ?? 'File', widget.attachment?.title ?? 'File',
style: TextStyle( style: StreamChatTheme.of(context).textTheme.bodyBold,
fontWeight: FontWeight.bold,
fontSize: 14.0,
),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
@@ -100,10 +97,10 @@ class _FileAttachmentState extends State<FileAttachment> {
), ),
Text( Text(
'${_getSizeText(widget.attachment.extraData['file_size'])}', '${_getSizeText(widget.attachment.extraData['file_size'])}',
style: TextStyle( style: StreamChatTheme.of(context)
color: Colors.black.withOpacity(0.5), .textTheme
fontSize: 14.0, .body
), .copyWith(color: Colors.black.withOpacity(0.5)),
), ),
], ],
), ),
+10 -7
View File
@@ -220,9 +220,12 @@ class GiphyAttachment extends StatelessWidget {
}, },
child: Text( child: Text(
'Cancel', 'Cancel',
style: TextStyle( style: StreamChatTheme.of(context)
fontWeight: FontWeight.bold, .textTheme
color: Colors.black.withOpacity(0.5)), .bodyBold
.copyWith(
color: Colors.black.withOpacity(0.5),
),
), ),
), ),
), ),
@@ -271,10 +274,10 @@ class GiphyAttachment extends StatelessWidget {
), ),
Text( Text(
'Only visible to you', 'Only visible to you',
style: TextStyle( style: StreamChatTheme.of(context)
color: Colors.black.withOpacity(0.5), .textTheme
fontSize: 12.0, .footnote
), .copyWith(color: Colors.black.withOpacity(0.5)),
), ),
], ],
), ),
+4 -5
View File
@@ -66,11 +66,10 @@ class ImageActionsModal extends StatelessWidget {
padding: const EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
child: Text( child: Text(
userName, userName,
style: TextStyle( style: StreamChatTheme.of(context)
fontSize: 16.0, .textTheme
fontWeight: FontWeight.w700, .headlineBold
color: Colors.white, .copyWith(color: Colors.white),
),
), ),
), ),
Text( Text(
+4 -15
View File
@@ -130,11 +130,7 @@ class _ImageFooterState extends State<ImageFooter> {
children: <Widget>[ children: <Widget>[
Text( Text(
'${widget.currentPage + 1} of ${widget.totalPages}', '${widget.currentPage + 1} of ${widget.totalPages}',
style: TextStyle( style: StreamChatTheme.of(context).textTheme.headlineBold,
fontSize: 16.0,
fontWeight: FontWeight.w700,
color: Colors.black,
),
), ),
], ],
), ),
@@ -182,11 +178,8 @@ class _ImageFooterState extends State<ImageFooter> {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Text( child: Text(
'Photos', 'Photos',
style: TextStyle( style:
fontSize: 16.0, StreamChatTheme.of(context).textTheme.headlineBold,
fontWeight: FontWeight.w700,
color: Colors.black,
),
), ),
), ),
), ),
@@ -490,11 +483,7 @@ class _ImageFooterState extends State<ImageFooter> {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Text( child: Text(
'Select a Chat to Share', 'Select a Chat to Share',
style: TextStyle( style: StreamChatTheme.of(context).textTheme.headlineBold,
fontSize: 16.0,
fontWeight: FontWeight.w700,
color: Colors.black,
),
), ),
), ),
Padding( Padding(
+1 -5
View File
@@ -81,11 +81,7 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget {
children: <Widget>[ children: <Widget>[
Text( Text(
userName, userName,
style: TextStyle( style: StreamChatTheme.of(context).textTheme.headlineBold,
fontSize: 16.0,
fontWeight: FontWeight.w700,
color: Colors.black,
),
), ),
Text( Text(
sentAt, sentAt,
+10 -7
View File
@@ -423,8 +423,10 @@ class MessageInputState extends State<MessageInput> {
), ),
Text( Text(
_chosenCommand?.name?.toUpperCase() ?? "", _chosenCommand?.name?.toUpperCase() ?? "",
style: TextStyle( style: StreamChatTheme.of(context)
color: Colors.white, fontSize: 12.0), .textTheme
.footnote
.copyWith(color: Colors.white),
), ),
], ],
), ),
@@ -899,11 +901,12 @@ class MessageInputState extends State<MessageInput> {
Center( Center(
child: Text( child: Text(
'Allow access to your gallery', 'Allow access to your gallery',
style: TextStyle( style: StreamChatTheme.of(context)
fontSize: 14, .textTheme
fontWeight: FontWeight.bold, .bodyBold
color: StreamChatTheme.of(context).accentColor, .copyWith(
), color: StreamChatTheme.of(context).accentColor,
),
), ),
), ),
], ],
+4 -4
View File
@@ -420,10 +420,10 @@ class _MessageWidgetState extends State<MessageWidget> {
SizedBox(width: 8.0), SizedBox(width: 8.0),
Text( Text(
'Only visible to you', 'Only visible to you',
style: TextStyle( style: StreamChatTheme.of(context)
color: Colors.black.withOpacity(0.5), .textTheme
fontSize: 12.0, .footnote
), .copyWith(color: Colors.black.withOpacity(0.5)),
), ),
], ],
), ),
+14 -12
View File
@@ -51,10 +51,12 @@ class UrlAttachment extends StatelessWidget {
), ),
child: Text( child: Text(
hostDisplayName, hostDisplayName,
style: TextStyle( style: StreamChatTheme.of(context)
fontWeight: FontWeight.w700, .textTheme
color: Color(0xFF006CFF), .bodyBold
), .copyWith(
color: Color(0xFF006CFF),
),
), ),
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -81,18 +83,18 @@ class UrlAttachment extends StatelessWidget {
urlAttachment.title.trim(), urlAttachment.title.trim(),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: StreamChatTheme.of(context)
fontWeight: FontWeight.w700, .textTheme
fontSize: 12.0, .body
), .copyWith(fontWeight: FontWeight.w700),
), ),
if (urlAttachment.text != null) if (urlAttachment.text != null)
Text( Text(
urlAttachment.text, urlAttachment.text,
style: TextStyle( style: StreamChatTheme.of(context)
fontWeight: FontWeight.w400, .textTheme
fontSize: 12.0, .body
), .copyWith(fontWeight: FontWeight.w400),
), ),
], ],
), ),
+1 -1
View File
@@ -45,7 +45,7 @@ Future<bool> showConfirmationDialog(
), ),
Text( Text(
title, title,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0), style: StreamChatTheme.of(context).textTheme.headlineBold,
), ),
SizedBox( SizedBox(
height: 7.0, height: 7.0,