Skip to content

Commit

Permalink
Merge pull request #92 from Iconica-Development/bugfix/feedback
Browse files Browse the repository at this point in the history
fix: feedback
  • Loading branch information
freekvandeven authored Jun 6, 2024
2 parents 5464766 + 1141aea commit 5e4a9c7
Show file tree
Hide file tree
Showing 38 changed files with 692 additions and 615 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 3.0.0

- Add theming
- add validator for group name
- fix spamming buttons
- fix user list flickering on the group creation screen

## 2.0.0

- Add a serviceBuilder to the userstory configuration
Expand Down
29 changes: 5 additions & 24 deletions packages/flutter_chat/example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
include: package:flutter_iconica_analysis/analysis_options.yaml

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
# Possible to overwrite the rules from the package

analyzer:
exclude:

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
31 changes: 14 additions & 17 deletions packages/flutter_chat/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_chat/flutter_chat.dart';
import "package:flutter/material.dart";
import "package:flutter_chat/flutter_chat.dart";

void main(List<String> args) async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -11,25 +11,22 @@ class App extends StatelessWidget {
const App({super.key});

@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Home(),
);
}
Widget build(BuildContext context) => const MaterialApp(
home: Home(),
);
}

class Home extends StatelessWidget {
const Home({super.key});

@override
Widget build(BuildContext context) {
return Center(
child: chatNavigatorUserStory(context,
configuration: ChatUserStoryConfiguration(
chatService: LocalChatService(),
chatOptionsBuilder: (ctx) => ChatOptions(
noChatsPlaceholderBuilder: (translations) =>
Text(translations.noUsersFound),
))));
}
Widget build(BuildContext context) => Center(
child: chatNavigatorUserStory(
context,
configuration: ChatUserStoryConfiguration(
chatService: LocalChatService(),
chatOptionsBuilder: (ctx) => const ChatOptions(),
),
),
);
}
14 changes: 13 additions & 1 deletion packages/flutter_chat/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,23 @@ dependencies:
path: ../
flutter_chat_firebase:
path: ../../flutter_chat_firebase
dependency_overrides:
flutter_chat:
path: ../../flutter_chat
flutter_chat_interface:
path: ../../flutter_chat_interface
flutter_chat_local:
path: ../../flutter_chat_local
flutter_chat_view:
path: ../../flutter_chat_view

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter_iconica_analysis:
git:
url: https://github.com/Iconica-Development/flutter_iconica_analysis
ref: 7.0.0

flutter:
uses-material-design: true
4 changes: 2 additions & 2 deletions packages/flutter_chat/example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter_test/flutter_test.dart';
import "package:flutter_test/flutter_test.dart";

void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
testWidgets("Counter increments smoke test", (WidgetTester tester) async {
expect(true, true);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ Widget _newGroupChatOverviewScreenRoute(
),
);
if (context.mounted) {
await Navigator.of(context).push(
await Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => _chatDetailScreenRoute(
configuration,
Expand Down
19 changes: 18 additions & 1 deletion packages/flutter_chat/lib/src/flutter_chat_userstory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ List<GoRoute> getChatStoryRoutes(
GoRoute(
path: ChatUserStoryRoutes.chatScreen,
pageBuilder: (context, state) {
var theme = Theme.of(context);
var service = configuration.chatServiceBuilder?.call(context) ??
configuration.chatService;
var chatScreen = ChatScreen(
Expand Down Expand Up @@ -47,6 +48,7 @@ List<GoRoute> getChatStoryRoutes(
chatScreen,
) ??
Scaffold(
backgroundColor: theme.colorScheme.surface,
body: chatScreen,
),
);
Expand All @@ -58,6 +60,8 @@ List<GoRoute> getChatStoryRoutes(
var chatId = state.pathParameters['id'];
var service = configuration.chatServiceBuilder?.call(context) ??
configuration.chatService;
var theme = Theme.of(context);

var chatDetailScreen = ChatDetailScreen(
chatTitleBuilder: configuration.chatTitleBuilder,
usernameBuilder: configuration.usernameBuilder,
Expand Down Expand Up @@ -118,6 +122,7 @@ List<GoRoute> getChatStoryRoutes(
chatDetailScreen,
) ??
Scaffold(
backgroundColor: theme.colorScheme.surface,
body: chatDetailScreen,
),
);
Expand All @@ -128,6 +133,8 @@ List<GoRoute> getChatStoryRoutes(
pageBuilder: (context, state) {
var service = configuration.chatServiceBuilder?.call(context) ??
configuration.chatService;
var theme = Theme.of(context);

var newChatScreen = NewChatScreen(
options: configuration.chatOptionsBuilder(context),
translations: configuration.translationsBuilder?.call(context) ??
Expand Down Expand Up @@ -165,6 +172,7 @@ List<GoRoute> getChatStoryRoutes(
newChatScreen,
) ??
Scaffold(
backgroundColor: theme.colorScheme.surface,
body: newChatScreen,
),
);
Expand All @@ -175,6 +183,8 @@ List<GoRoute> getChatStoryRoutes(
pageBuilder: (context, state) {
var service = configuration.chatServiceBuilder?.call(context) ??
configuration.chatService;
var theme = Theme.of(context);

var newGroupChatScreen = NewGroupChatScreen(
options: configuration.chatOptionsBuilder(context),
translations: configuration.translationsBuilder?.call(context) ??
Expand All @@ -193,6 +203,7 @@ List<GoRoute> getChatStoryRoutes(
newGroupChatScreen,
) ??
Scaffold(
backgroundColor: theme.colorScheme.surface,
body: newGroupChatScreen,
),
);
Expand All @@ -204,6 +215,8 @@ List<GoRoute> getChatStoryRoutes(
var service = configuration.chatServiceBuilder?.call(context) ??
configuration.chatService;
var users = state.extra! as List<ChatUserModel>;
var theme = Theme.of(context);

var newGroupChatOverviewScreen = NewGroupChatOverviewScreen(
options: configuration.chatOptionsBuilder(context),
translations: configuration.translationsBuilder?.call(context) ??
Expand All @@ -223,7 +236,7 @@ List<GoRoute> getChatStoryRoutes(
),
);
if (context.mounted) {
await context.push(
context.go(
ChatUserStoryRoutes.chatDetailViewPath(chat.id ?? ''),
);
}
Expand All @@ -237,6 +250,7 @@ List<GoRoute> getChatStoryRoutes(
newGroupChatOverviewScreen,
) ??
Scaffold(
backgroundColor: theme.colorScheme.surface,
body: newGroupChatOverviewScreen,
),
);
Expand All @@ -250,6 +264,8 @@ List<GoRoute> getChatStoryRoutes(
var id = userId == 'null' ? null : userId;
var service = configuration.chatServiceBuilder?.call(context) ??
configuration.chatService;
var theme = Theme.of(context);

var profileScreen = ChatProfileScreen(
translations: configuration.translationsBuilder?.call(context) ??
configuration.translations,
Expand All @@ -274,6 +290,7 @@ List<GoRoute> getChatStoryRoutes(
profileScreen,
) ??
Scaffold(
backgroundColor: theme.colorScheme.surface,
body: profileScreen,
),
);
Expand Down
10 changes: 5 additions & 5 deletions packages/flutter_chat/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: flutter_chat
description: A new Flutter package project.
version: 2.0.0
version: 3.0.0

publish_to: none

Expand All @@ -20,23 +20,23 @@ dependencies:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_view
ref: 2.0.0
ref: 3.0.0
flutter_chat_interface:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_interface
ref: 2.0.0
ref: 3.0.0
flutter_chat_local:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_local
ref: 2.0.0
ref: 3.0.0
uuid: ^4.3.3

dev_dependencies:
flutter_iconica_analysis:
git:
url: https://github.com/Iconica-Development/flutter_iconica_analysis
ref: 6.0.0
ref: 7.0.0

flutter:
6 changes: 3 additions & 3 deletions packages/flutter_chat_firebase/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: flutter_chat_firebase
description: A new Flutter package project.
version: 2.0.0
version: 3.0.0
publish_to: none

environment:
Expand All @@ -23,12 +23,12 @@ dependencies:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_interface
ref: 2.0.0
ref: 3.0.0

dev_dependencies:
flutter_iconica_analysis:
git:
url: https://github.com/Iconica-Development/flutter_iconica_analysis
ref: 6.0.0
ref: 7.0.0

flutter:
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
///
library flutter_chat_interface;

export 'package:flutter_chat_interface/src/chat_data_provider.dart';
export 'package:flutter_chat_interface/src/model/model.dart';
export 'package:flutter_chat_interface/src/service/service.dart';
export "package:flutter_chat_interface/src/chat_data_provider.dart";
export "package:flutter_chat_interface/src/model/model.dart";
export "package:flutter_chat_interface/src/service/service.dart";
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//
// SPDX-License-Identifier: BSD-3-Clause

import 'package:flutter_chat_interface/flutter_chat_interface.dart';
import 'package:flutter_data_interface/flutter_data_interface.dart';
import "package:flutter_chat_interface/flutter_chat_interface.dart";
import "package:flutter_data_interface/flutter_data_interface.dart";

class ChatDataProvider extends DataInterface {
ChatDataProvider({
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_chat_interface/lib/src/model/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: BSD-3-Clause

import 'package:flutter_chat_interface/flutter_chat_interface.dart';
import "package:flutter_chat_interface/flutter_chat_interface.dart";

abstract class ChatModelInterface {
ChatModelInterface copyWith();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: BSD-3-Clause

import 'package:flutter_chat_interface/flutter_chat_interface.dart';
import "package:flutter_chat_interface/flutter_chat_interface.dart";

/// An abstract class defining the interface for an image message in a chat.
abstract class ChatImageMessageModelInterface extends ChatMessageModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: BSD-3-Clause

import 'package:flutter_chat_interface/src/model/chat_user.dart';
import "package:flutter_chat_interface/src/model/chat_user.dart";

abstract class ChatMessageModelInterface {
ChatUserModel get sender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: BSD-3-Clause

import 'package:flutter_chat_interface/flutter_chat_interface.dart';
import "package:flutter_chat_interface/flutter_chat_interface.dart";

abstract class ChatTextMessageModelInterface extends ChatMessageModel {
ChatTextMessageModelInterface({
Expand Down
8 changes: 4 additions & 4 deletions packages/flutter_chat_interface/lib/src/model/chat_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: BSD-3-Clause

import 'package:flutter/material.dart';
import "package:flutter/material.dart";

abstract class ChatUserModelInterface {
String? get id;
Expand Down Expand Up @@ -49,17 +49,17 @@ class ChatUserModel implements ChatUserModelInterface {

@override
String? get fullName {
var fullName = '';
var fullName = "";

if (firstName != null && lastName != null) {
fullName += '$firstName $lastName';
fullName += "$firstName $lastName";
} else if (firstName != null) {
fullName += firstName!;
} else if (lastName != null) {
fullName += lastName!;
}

return fullName == '' ? null : fullName;
return fullName == "" ? null : fullName;
}

@override
Expand Down
Loading

0 comments on commit 5e4a9c7

Please sign in to comment.