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