diff --git a/packages/flutter_chat/lib/src/models/chat_configuration.dart b/packages/flutter_chat/lib/src/models/chat_configuration.dart index 26218c5..3175620 100644 --- a/packages/flutter_chat/lib/src/models/chat_configuration.dart +++ b/packages/flutter_chat/lib/src/models/chat_configuration.dart @@ -19,7 +19,7 @@ class ChatUserStoryConfiguration { this.onReadChat, this.onUploadImage, this.onPressCreateChat, - this.iconColor, + this.iconColor = Colors.black, this.deleteChatDialog, this.disableDismissForPermanentChats = false, this.routeToNewChatIfEmpty = true, @@ -29,7 +29,7 @@ class ChatUserStoryConfiguration { this.afterMessageSent, this.messagePageSize = 20, this.onPressUserProfile, - this.textfieldBottomPadding = 0, + this.textfieldBottomPadding = 20, this.iconDisabledColor = Colors.grey, this.unreadMessageTextStyle, this.loadingWidgetBuilder, diff --git a/packages/flutter_chat_view/lib/src/config/chat_options.dart b/packages/flutter_chat_view/lib/src/config/chat_options.dart index 0b3a9b3..a7640ad 100644 --- a/packages/flutter_chat_view/lib/src/config/chat_options.dart +++ b/packages/flutter_chat_view/lib/src/config/chat_options.dart @@ -36,13 +36,17 @@ Widget _createNewChatButton( ChatTranslations translations, ) => Padding( - padding: const EdgeInsets.all(16.0), + padding: const EdgeInsets.all(24.0), child: ElevatedButton( style: ElevatedButton.styleFrom( + backgroundColor: Colors.black, minimumSize: const Size.fromHeight(50), ), onPressed: onPressed, - child: Text(translations.newChatButton), + child: Text( + translations.newChatButton, + style: const TextStyle(color: Colors.white), + ), ), ); @@ -52,10 +56,38 @@ Widget _createMessageInput( ChatTranslations translations, ) => TextField( + textCapitalization: TextCapitalization.sentences, controller: textEditingController, decoration: InputDecoration( + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(26.5), + borderSide: const BorderSide( + color: Colors.black, + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(26.5), + borderSide: const BorderSide( + color: Colors.black, + ), + ), + contentPadding: const EdgeInsets.symmetric( + vertical: 0, + horizontal: 30, + ), hintText: translations.messagePlaceholder, - + hintStyle: const TextStyle( + fontWeight: FontWeight.normal, + color: Colors.black, + ), + fillColor: Colors.white, + filled: true, + border: const OutlineInputBorder( + borderRadius: BorderRadius.all( + Radius.circular(26.5), + ), + borderSide: BorderSide.none, + ), suffixIcon: suffixIcon, ), ); @@ -80,9 +112,13 @@ Widget _createImagePickerContainer( color: Colors.white, child: ImagePicker( customButton: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Colors.black, + ), onPressed: onClose, child: Text( translations.cancelImagePickerBtn, + style: const TextStyle(color: Colors.white), ), ), ), diff --git a/packages/flutter_chat_view/lib/src/screens/chat_detail_screen.dart b/packages/flutter_chat_view/lib/src/screens/chat_detail_screen.dart index 34b71e8..8a124c5 100644 --- a/packages/flutter_chat_view/lib/src/screens/chat_detail_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/chat_detail_screen.dart @@ -137,6 +137,8 @@ class _ChatDetailScreenState extends State { @override Widget build(BuildContext context) { + var theme = Theme.of(context); + Future onPressSelectImage() async => showModalBottomSheet( context: context, builder: (BuildContext context) => @@ -166,6 +168,9 @@ class _ChatDetailScreenState extends State { var chatModel = snapshot.data; return Scaffold( appBar: AppBar( + backgroundColor: theme.appBarTheme.backgroundColor ?? Colors.black, + iconTheme: theme.appBarTheme.iconTheme ?? + const IconThemeData(color: Colors.white), centerTitle: true, title: GestureDetector( onTap: () => widget.onPressChatTitle.call(context, chatModel!), @@ -208,7 +213,10 @@ class _ChatDetailScreenState extends State { widget .translations.anonymousUser : '', - style: const TextStyle(fontSize: 18), + style: theme.appBarTheme.titleTextStyle ?? + const TextStyle( + color: Colors.white, + ), ), ), ), diff --git a/packages/flutter_chat_view/lib/src/screens/chat_profile_screen.dart b/packages/flutter_chat_view/lib/src/screens/chat_profile_screen.dart index 4a1c2fd..00fae43 100644 --- a/packages/flutter_chat_view/lib/src/screens/chat_profile_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/chat_profile_screen.dart @@ -28,6 +28,7 @@ class _ProfileScreenState extends State { Widget build(BuildContext context) { var size = MediaQuery.of(context).size; var hasUser = widget.userId == null; + var theme = Theme.of(context); return FutureBuilder( future: hasUser // ignore: discarded_futures @@ -60,6 +61,9 @@ class _ProfileScreenState extends State { return Scaffold( appBar: AppBar( + backgroundColor: theme.appBarTheme.backgroundColor ?? Colors.black, + iconTheme: theme.appBarTheme.iconTheme ?? + const IconThemeData(color: Colors.white), title: Text( (data is ChatUserModel) ? '${data.firstName ?? ''} ${data.lastName ?? ''}' @@ -68,6 +72,10 @@ class _ProfileScreenState extends State { : (data is GroupChatModel) ? data.title : '', + style: theme.appBarTheme.titleTextStyle ?? + const TextStyle( + color: Colors.white, + ), ), ), body: snapshot.hasData diff --git a/packages/flutter_chat_view/lib/src/screens/chat_screen.dart b/packages/flutter_chat_view/lib/src/screens/chat_screen.dart index 50a7791..74b0c9c 100644 --- a/packages/flutter_chat_view/lib/src/screens/chat_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/chat_screen.dart @@ -60,9 +60,17 @@ class _ChatScreenState extends State { @override Widget build(BuildContext context) { var translations = widget.translations; + var theme = Theme.of(context); return widget.options.scaffoldBuilder( AppBar( - title: Text(translations.chatsTitle), + backgroundColor: theme.appBarTheme.backgroundColor ?? Colors.black, + title: Text( + translations.chatsTitle, + style: theme.appBarTheme.titleTextStyle ?? + const TextStyle( + color: Colors.white, + ), + ), centerTitle: true, actions: [ StreamBuilder( @@ -76,7 +84,7 @@ class _ChatScreenState extends State { '${snapshot.data ?? 0} ${translations.chatsUnread}', style: widget.unreadMessageTextStyle ?? const TextStyle( - color: Color(0xFFBBBBBB), + color: Colors.white, fontSize: 14, ), ), diff --git a/packages/flutter_chat_view/lib/src/screens/new_chat_screen.dart b/packages/flutter_chat_view/lib/src/screens/new_chat_screen.dart index bbada0d..433619b 100644 --- a/packages/flutter_chat_view/lib/src/screens/new_chat_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/new_chat_screen.dart @@ -29,63 +29,100 @@ class _NewChatScreenState extends State { String query = ''; @override - Widget build(BuildContext context) => Scaffold( - appBar: AppBar( - title: _buildSearchField(), - actions: [ - _buildSearchIcon(), - ], - ), - body: FutureBuilder>( - // ignore: discarded_futures - future: widget.service.chatUserService.getAllUsers(), - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - return Text('Error: ${snapshot.error}'); - } else if (snapshot.hasData) { - return _buildUserList(snapshot.data!); - } else { - return widget.options - .noChatsPlaceholderBuilder(widget.translations); - } - }, - ), - ); - - Widget _buildSearchField() => _isSearching - ? Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: TextField( - focusNode: _textFieldFocusNode, - onChanged: (value) { - setState(() { - query = value; - }); - }, - decoration: InputDecoration( - hintText: widget.translations.searchPlaceholder, - ), - ), - ) - : Text(widget.translations.newChatButton); - - Widget _buildSearchIcon() => IconButton( - onPressed: () { - setState(() { - _isSearching = !_isSearching; - query = ''; - }); - - if (_isSearching) { - _textFieldFocusNode.requestFocus(); + Widget build(BuildContext context) { + var theme = Theme.of(context); + return Scaffold( + appBar: AppBar( + iconTheme: theme.appBarTheme.iconTheme ?? + const IconThemeData(color: Colors.white), + backgroundColor: theme.appBarTheme.backgroundColor ?? Colors.black, + title: _buildSearchField(), + actions: [ + _buildSearchIcon(), + ], + ), + body: FutureBuilder>( + // ignore: discarded_futures + future: widget.service.chatUserService.getAllUsers(), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else if (snapshot.hasData) { + return _buildUserList(snapshot.data!); + } else { + return widget.options + .noChatsPlaceholderBuilder(widget.translations); } }, - icon: Icon( - _isSearching ? Icons.close : Icons.search, - ), - ); + ), + ); + } + + Widget _buildSearchField() { + var theme = Theme.of(context); + + return _isSearching + ? Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: TextField( + focusNode: _textFieldFocusNode, + onChanged: (value) { + setState(() { + query = value; + }); + }, + decoration: InputDecoration( + hintText: widget.translations.searchPlaceholder, + hintStyle: theme.inputDecorationTheme.hintStyle ?? + const TextStyle( + color: Colors.white, + ), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: theme.inputDecorationTheme.focusedBorder?.borderSide + .color ?? + Colors.white, + ), + ), + ), + style: theme.inputDecorationTheme.hintStyle ?? + const TextStyle( + color: Colors.white, + ), + cursorColor: theme.textSelectionTheme.cursorColor ?? Colors.white, + ), + ) + : Text( + widget.translations.newChatButton, + style: theme.appBarTheme.titleTextStyle ?? + const TextStyle( + color: Colors.white, + ), + ); + } + + Widget _buildSearchIcon() { + var theme = Theme.of(context); + + return IconButton( + onPressed: () { + setState(() { + _isSearching = !_isSearching; + query = ''; + }); + + if (_isSearching) { + _textFieldFocusNode.requestFocus(); + } + }, + icon: Icon( + _isSearching ? Icons.close : Icons.search, + color: theme.appBarTheme.iconTheme?.color ?? Colors.white, + ), + ); + } Widget _buildUserList(List users) { var filteredUsers = users