Skip to content

Commit

Permalink
added working center title
Browse files Browse the repository at this point in the history
  • Loading branch information
lcsvcn committed Nov 19, 2024
1 parent 5306396 commit 779130c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 46 deletions.
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
14 changes: 7 additions & 7 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -342,7 +342,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -361,7 +361,7 @@
DEVELOPMENT_TEAM = KX234MPD84;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -421,7 +421,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -470,7 +470,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -490,7 +490,7 @@
DEVELOPMENT_TEAM = KX234MPD84;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -514,7 +514,7 @@
DEVELOPMENT_TEAM = KX234MPD84;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
30 changes: 11 additions & 19 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class Example extends StatelessWidget {
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: const Color(0xffEE5366),
colorScheme:
ColorScheme.fromSwatch(accentColor: const Color(0xffEE5366)),
colorScheme: ColorScheme.fromSwatch(accentColor: const Color(0xffEE5366)),
),
home: const ChatScreen(),
);
Expand Down Expand Up @@ -123,8 +122,8 @@ class _ChatScreenState extends State<ChatScreen> {
flashingCircleDarkColor: theme.flashingCircleDarkColor,
),
appBar: ChatViewAppBar(
elevation: theme.elevation,
backgroundColor: theme.appBarColor,
elevation: theme.elevation!,
backgroundColor: theme.appBarColor!,
profilePicture: Data.profileImage,
backArrowColor: theme.backArrowColor,
chatTitle: "Chat view",
Expand All @@ -135,14 +134,13 @@ class _ChatScreenState extends State<ChatScreen> {
letterSpacing: 0.25,
),
userStatus: "online",
centerTitle: false,
userStatusTextStyle: const TextStyle(color: Colors.grey),
actions: [
IconButton(
onPressed: _onThemeIconTap,
icon: Icon(
isDarkTheme
? Icons.brightness_4_outlined
: Icons.dark_mode_outlined,
isDarkTheme ? Icons.brightness_4_outlined : Icons.dark_mode_outlined,
color: theme.themeIconColor,
),
),
Expand Down Expand Up @@ -212,8 +210,7 @@ class _ChatScreenState extends State<ChatScreen> {
bodyStyle: theme.outgoingChatLinkBodyStyle,
titleStyle: theme.outgoingChatLinkTitleStyle,
),
receiptsWidgetConfig:
const ReceiptsWidgetConfig(showReceiptsIn: ShowReceiptsIn.all),
receiptsWidgetConfig: const ReceiptsWidgetConfig(showReceiptsIn: ShowReceiptsIn.all),
color: theme.outgoingChatBubbleColor,
),
inComingChatBubbleConfig: ChatBubble(
Expand All @@ -231,8 +228,7 @@ class _ChatScreenState extends State<ChatScreen> {
/// send your message reciepts to the other client
debugPrint('Message Read');
},
senderNameTextStyle:
TextStyle(color: theme.inComingChatBubbleTextColor),
senderNameTextStyle: TextStyle(color: theme.inComingChatBubbleTextColor),
color: theme.inComingChatBubbleColor,
),
),
Expand All @@ -252,10 +248,8 @@ class _ChatScreenState extends State<ChatScreen> {
messageReactionConfig: MessageReactionConfiguration(
backgroundColor: theme.messageReactionBackGroundColor,
borderColor: theme.messageReactionBackGroundColor,
reactedUserCountTextStyle:
TextStyle(color: theme.inComingChatBubbleTextColor),
reactionCountTextStyle:
TextStyle(color: theme.inComingChatBubbleTextColor),
reactedUserCountTextStyle: TextStyle(color: theme.inComingChatBubbleTextColor),
reactionCountTextStyle: TextStyle(color: theme.inComingChatBubbleTextColor),
reactionsBottomSheetConfig: ReactionsBottomSheetConfiguration(
backgroundColor: theme.backgroundColor,
reactedUserTextStyle: TextStyle(
Expand Down Expand Up @@ -316,8 +310,7 @@ class _ChatScreenState extends State<ChatScreen> {
color: isDarkTheme ? Colors.white : Colors.black,
),
),
onTap: (item) =>
_onSendTap(item.text, const ReplyMessage(), MessageType.text),
onTap: (item) => _onSendTap(item.text, const ReplyMessage(), MessageType.text),
),
),
);
Expand All @@ -339,8 +332,7 @@ class _ChatScreenState extends State<ChatScreen> {
),
);
Future.delayed(const Duration(milliseconds: 300), () {
_chatController.initialMessageList.last.setStatus =
MessageStatus.undelivered;
_chatController.initialMessageList.last.setStatus = MessageStatus.undelivered;
});
Future.delayed(const Duration(seconds: 1), () {
_chatController.initialMessageList.last.setStatus = MessageStatus.read;
Expand Down
35 changes: 19 additions & 16 deletions lib/src/widgets/chat_view_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,27 @@ class ChatViewAppBar extends StatelessWidget {
networkImageProgressIndicatorBuilder: networkImageProgressIndicatorBuilder,
),
),
Column(
crossAxisAlignment: centerTitle ? CrossAxisAlignment.center : CrossAxisAlignment.start,
children: [
Text(
chatTitle,
style: chatTitleTextStyle ??
const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.25,
),
),
if (userStatus != null)
Expanded(
child: Column(
crossAxisAlignment: centerTitle ? CrossAxisAlignment.center : CrossAxisAlignment.start,
mainAxisAlignment: centerTitle ? MainAxisAlignment.center : MainAxisAlignment.start,
children: [
Text(
userStatus!,
style: userStatusTextStyle,
chatTitle,
style: chatTitleTextStyle ??
const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.25,
),
),
],
if (userStatus != null)
Text(
userStatus!,
style: userStatusTextStyle,
),
],
),
),
],
),
Expand Down

0 comments on commit 779130c

Please sign in to comment.