style: provide folder structure
This commit is contained in:
@@ -0,0 +1,182 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:example/pages/choose_user_page.dart';
|
||||||
|
import 'package:example/pages/home_page.dart';
|
||||||
|
import 'package:example/utils/localizations.dart';
|
||||||
|
import 'package:example/pages/splash_screen.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/scheduler.dart';
|
||||||
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
import 'package:stream_chat_localizations/stream_chat_localizations.dart';
|
||||||
|
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
|
||||||
|
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
||||||
|
|
||||||
|
import 'routes/app_routes.dart';
|
||||||
|
import 'routes/routes.dart';
|
||||||
|
|
||||||
|
final chatPersistentClient = StreamChatPersistenceClient(
|
||||||
|
logLevel: Level.SEVERE,
|
||||||
|
connectionMode: ConnectionMode.regular,
|
||||||
|
);
|
||||||
|
|
||||||
|
void sampleAppLogHandler(LogRecord record) async {
|
||||||
|
if (kDebugMode) StreamChatClient.defaultLogHandler(record);
|
||||||
|
|
||||||
|
// report errors to setnry.io
|
||||||
|
if (record.error != null || record.stackTrace != null) {
|
||||||
|
await Sentry.captureException(
|
||||||
|
record.error,
|
||||||
|
stackTrace: record.stackTrace,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamChatClient buildStreamChatClient(
|
||||||
|
String apiKey, {
|
||||||
|
Level logLevel = Level.INFO,
|
||||||
|
}) {
|
||||||
|
return StreamChatClient(
|
||||||
|
apiKey,
|
||||||
|
logLevel: logLevel,
|
||||||
|
logHandlerFunction: sampleAppLogHandler,
|
||||||
|
)..chatPersistenceClient = chatPersistentClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_MyAppState createState() => _MyAppState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyAppState extends State<MyApp>
|
||||||
|
with SplashScreenStateMixin, TickerProviderStateMixin {
|
||||||
|
InitData? _initData;
|
||||||
|
|
||||||
|
Future<InitData> _initConnection() async {
|
||||||
|
String? apiKey, userId, token;
|
||||||
|
|
||||||
|
if (!kIsWeb) {
|
||||||
|
final secureStorage = FlutterSecureStorage();
|
||||||
|
apiKey = await secureStorage.read(key: kStreamApiKey);
|
||||||
|
userId = await secureStorage.read(key: kStreamUserId);
|
||||||
|
token = await secureStorage.read(key: kStreamToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
final client = buildStreamChatClient(apiKey ?? kStreamApiKey);
|
||||||
|
|
||||||
|
if (userId != null && token != null) {
|
||||||
|
await client.connectUser(
|
||||||
|
User(id: userId),
|
||||||
|
token,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final prefs = await StreamingSharedPreferences.instance;
|
||||||
|
|
||||||
|
return InitData(client, prefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
final timeOfStartMs = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
|
||||||
|
_initConnection().then(
|
||||||
|
(initData) {
|
||||||
|
setState(() {
|
||||||
|
_initData = initData;
|
||||||
|
});
|
||||||
|
|
||||||
|
final now = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
|
||||||
|
if (now - timeOfStartMs > 1500) {
|
||||||
|
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
|
forwardAnimations();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Future.delayed(Duration(milliseconds: 1500)).then((value) {
|
||||||
|
forwardAnimations();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
if (_initData != null)
|
||||||
|
PreferenceBuilder<int>(
|
||||||
|
preference: _initData!.preferences.getInt(
|
||||||
|
'theme',
|
||||||
|
defaultValue: 0,
|
||||||
|
),
|
||||||
|
builder: (context, snapshot) => MaterialApp(
|
||||||
|
theme: ThemeData.light(),
|
||||||
|
darkTheme: ThemeData.dark(),
|
||||||
|
themeMode: {
|
||||||
|
-1: ThemeMode.dark,
|
||||||
|
0: ThemeMode.system,
|
||||||
|
1: ThemeMode.light,
|
||||||
|
}[snapshot],
|
||||||
|
supportedLocales: const [
|
||||||
|
Locale('en'),
|
||||||
|
Locale('it'),
|
||||||
|
],
|
||||||
|
localizationsDelegates: const [
|
||||||
|
AppLocalizationsDelegate(),
|
||||||
|
GlobalStreamChatLocalizations.delegate,
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
],
|
||||||
|
builder: (context, child) => StreamChatConfiguration(
|
||||||
|
data: StreamChatConfigurationData(),
|
||||||
|
child: StreamChatTheme(
|
||||||
|
data: StreamChatThemeData(
|
||||||
|
brightness: Theme.of(context).brightness,
|
||||||
|
),
|
||||||
|
child: child!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onGenerateRoute: AppRoutes.generateRoute,
|
||||||
|
onGenerateInitialRoutes: (initialRouteName) {
|
||||||
|
if (initialRouteName == Routes.HOME) {
|
||||||
|
return [
|
||||||
|
AppRoutes.generateRoute(
|
||||||
|
RouteSettings(
|
||||||
|
name: Routes.HOME,
|
||||||
|
arguments: HomePageArgs(_initData!.client),
|
||||||
|
),
|
||||||
|
)!
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
AppRoutes.generateRoute(
|
||||||
|
RouteSettings(
|
||||||
|
name: Routes.CHOOSE_USER,
|
||||||
|
),
|
||||||
|
)!
|
||||||
|
];
|
||||||
|
},
|
||||||
|
initialRoute: _initData!.client.state.currentUser == null
|
||||||
|
? Routes.CHOOSE_USER
|
||||||
|
: Routes.HOME,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!animationCompleted) buildAnimation(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class InitData {
|
||||||
|
final StreamChatClient client;
|
||||||
|
final StreamingSharedPreferences preferences;
|
||||||
|
|
||||||
|
InitData(this.client, this.preferences);
|
||||||
|
}
|
||||||
@@ -1,54 +1,13 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:example/choose_user_page.dart';
|
import 'package:example/utils/app_config.dart';
|
||||||
import 'package:example/home_page.dart';
|
|
||||||
import 'package:example/localizations.dart';
|
|
||||||
import 'package:example/splash_screen.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
||||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
|
||||||
import 'package:stream_chat_localizations/stream_chat_localizations.dart';
|
|
||||||
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
|
|
||||||
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
|
||||||
|
|
||||||
import 'routes/app_routes.dart';
|
import 'package:example/app.dart';
|
||||||
import 'routes/routes.dart';
|
|
||||||
|
|
||||||
final chatPersistentClient = StreamChatPersistenceClient(
|
|
||||||
logLevel: Level.SEVERE,
|
|
||||||
connectionMode: ConnectionMode.regular,
|
|
||||||
);
|
|
||||||
|
|
||||||
void sampleAppLogHandler(LogRecord record) async {
|
|
||||||
if (kDebugMode) StreamChatClient.defaultLogHandler(record);
|
|
||||||
|
|
||||||
// report errors to sentry
|
|
||||||
if (record.error != null || record.stackTrace != null) {
|
|
||||||
await Sentry.captureException(
|
|
||||||
record.error,
|
|
||||||
stackTrace: record.stackTrace,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StreamChatClient buildStreamChatClient(
|
|
||||||
String apiKey, {
|
|
||||||
Level logLevel = Level.INFO,
|
|
||||||
}) {
|
|
||||||
return StreamChatClient(
|
|
||||||
apiKey,
|
|
||||||
logLevel: logLevel,
|
|
||||||
logHandlerFunction: sampleAppLogHandler,
|
|
||||||
)..chatPersistenceClient = chatPersistentClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
const sentryDsn =
|
|
||||||
'https://6381ef88de4140db8f5e25ab37e0f08c@o1213503.ingest.sentry.io/6352870';
|
|
||||||
|
|
||||||
/// Captures errors reported by the Flutter framework.
|
/// Captures errors reported by the Flutter framework.
|
||||||
FlutterError.onError = (FlutterErrorDetails details) {
|
FlutterError.onError = (FlutterErrorDetails details) {
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
@@ -82,139 +41,3 @@ void main() async {
|
|||||||
_reportError,
|
_reportError,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
|
||||||
@override
|
|
||||||
_MyAppState createState() => _MyAppState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MyAppState extends State<MyApp>
|
|
||||||
with SplashScreenStateMixin, TickerProviderStateMixin {
|
|
||||||
InitData? _initData;
|
|
||||||
|
|
||||||
Future<InitData> _initConnection() async {
|
|
||||||
String? apiKey, userId, token;
|
|
||||||
|
|
||||||
if (!kIsWeb) {
|
|
||||||
final secureStorage = FlutterSecureStorage();
|
|
||||||
apiKey = await secureStorage.read(key: kStreamApiKey);
|
|
||||||
userId = await secureStorage.read(key: kStreamUserId);
|
|
||||||
token = await secureStorage.read(key: kStreamToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
final client = buildStreamChatClient(apiKey ?? kStreamApiKey);
|
|
||||||
|
|
||||||
if (userId != null && token != null) {
|
|
||||||
await client.connectUser(
|
|
||||||
User(id: userId),
|
|
||||||
token,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final prefs = await StreamingSharedPreferences.instance;
|
|
||||||
|
|
||||||
return InitData(client, prefs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
final timeOfStartMs = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
|
|
||||||
_initConnection().then(
|
|
||||||
(initData) {
|
|
||||||
setState(() {
|
|
||||||
_initData = initData;
|
|
||||||
});
|
|
||||||
|
|
||||||
final now = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
|
|
||||||
if (now - timeOfStartMs > 1500) {
|
|
||||||
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
|
|
||||||
forwardAnimations();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Future.delayed(Duration(milliseconds: 1500)).then((value) {
|
|
||||||
forwardAnimations();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Stack(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
|
||||||
if (_initData != null)
|
|
||||||
PreferenceBuilder<int>(
|
|
||||||
preference: _initData!.preferences.getInt(
|
|
||||||
'theme',
|
|
||||||
defaultValue: 0,
|
|
||||||
),
|
|
||||||
builder: (context, snapshot) => MaterialApp(
|
|
||||||
theme: ThemeData.light(),
|
|
||||||
darkTheme: ThemeData.dark(),
|
|
||||||
themeMode: {
|
|
||||||
-1: ThemeMode.dark,
|
|
||||||
0: ThemeMode.system,
|
|
||||||
1: ThemeMode.light,
|
|
||||||
}[snapshot],
|
|
||||||
supportedLocales: const [
|
|
||||||
Locale('en'),
|
|
||||||
Locale('it'),
|
|
||||||
],
|
|
||||||
localizationsDelegates: const [
|
|
||||||
AppLocalizationsDelegate(),
|
|
||||||
GlobalStreamChatLocalizations.delegate,
|
|
||||||
GlobalMaterialLocalizations.delegate,
|
|
||||||
GlobalWidgetsLocalizations.delegate,
|
|
||||||
],
|
|
||||||
builder: (context, child) => StreamChatConfiguration(
|
|
||||||
data: StreamChatConfigurationData(),
|
|
||||||
child: StreamChatTheme(
|
|
||||||
data: StreamChatThemeData(
|
|
||||||
brightness: Theme.of(context).brightness,
|
|
||||||
),
|
|
||||||
child: child!,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onGenerateRoute: AppRoutes.generateRoute,
|
|
||||||
onGenerateInitialRoutes: (initialRouteName) {
|
|
||||||
if (initialRouteName == Routes.HOME) {
|
|
||||||
return [
|
|
||||||
AppRoutes.generateRoute(
|
|
||||||
RouteSettings(
|
|
||||||
name: Routes.HOME,
|
|
||||||
arguments: HomePageArgs(_initData!.client),
|
|
||||||
),
|
|
||||||
)!
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return [
|
|
||||||
AppRoutes.generateRoute(
|
|
||||||
RouteSettings(
|
|
||||||
name: Routes.CHOOSE_USER,
|
|
||||||
),
|
|
||||||
)!
|
|
||||||
];
|
|
||||||
},
|
|
||||||
initialRoute: _initData!.client.state.currentUser == null
|
|
||||||
? Routes.CHOOSE_USER
|
|
||||||
: Routes.HOME,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (!animationCompleted) buildAnimation(),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class InitData {
|
|
||||||
final StreamChatClient client;
|
|
||||||
final StreamingSharedPreferences preferences;
|
|
||||||
|
|
||||||
InitData(this.client, this.preferences);
|
|
||||||
}
|
|
||||||
|
|||||||
+4
-4
@@ -1,13 +1,13 @@
|
|||||||
import 'package:example/home_page.dart';
|
import 'package:example/app.dart';
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/pages/home_page.dart';
|
||||||
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:example/stream_version.dart';
|
import 'package:example/widgets/stream_version.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
import 'choose_user_page.dart';
|
import 'choose_user_page.dart';
|
||||||
import 'main.dart';
|
|
||||||
|
|
||||||
class AdvancedOptionsPage extends StatefulWidget {
|
class AdvancedOptionsPage extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'package:video_player/video_player.dart';
|
import 'package:video_player/video_player.dart';
|
||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:example/user_mentions_page.dart';
|
import 'package:example/pages/user_mentions_page.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_app_badger/flutter_app_badger.dart';
|
import 'package:flutter_app_badger/flutter_app_badger.dart';
|
||||||
@@ -10,7 +10,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
||||||
|
|
||||||
import 'channel_list.dart';
|
import 'package:example/widgets/channel_list.dart';
|
||||||
|
|
||||||
class ChannelListPage extends StatefulWidget {
|
class ChannelListPage extends StatefulWidget {
|
||||||
const ChannelListPage({
|
const ChannelListPage({
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:example/thread_page.dart';
|
import 'package:example/pages/thread_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
+4
-5
@@ -1,11 +1,10 @@
|
|||||||
import 'package:example/localizations.dart';
|
import 'package:example/pages/channel_file_display_screen.dart';
|
||||||
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
import 'package:example/pages/channel_media_display_screen.dart';
|
||||||
import 'channel_file_display_screen.dart';
|
import 'package:example/pages/pinned_messages_screen.dart';
|
||||||
import 'channel_media_display_screen.dart';
|
|
||||||
import 'pinned_messages_screen.dart';
|
|
||||||
|
|
||||||
/// Detail screen for a 1:1 chat correspondence
|
/// Detail screen for a 1:1 chat correspondence
|
||||||
class ChatInfoScreen extends StatefulWidget {
|
class ChatInfoScreen extends StatefulWidget {
|
||||||
+6
-6
@@ -1,15 +1,15 @@
|
|||||||
import 'package:example/app_config.dart';
|
import 'package:example/app.dart';
|
||||||
import 'package:example/home_page.dart';
|
import 'package:example/utils/app_config.dart';
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/pages/home_page.dart';
|
||||||
import 'package:example/stream_version.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
|
import 'package:example/widgets/stream_version.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
import 'main.dart';
|
import '../routes/routes.dart';
|
||||||
import 'routes/routes.dart';
|
|
||||||
|
|
||||||
const kStreamApiKey = 'STREAM_API_KEY';
|
const kStreamApiKey = 'STREAM_API_KEY';
|
||||||
const kStreamUserId = 'STREAM_USER_ID';
|
const kStreamUserId = 'STREAM_USER_ID';
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
import 'channel_page.dart';
|
import 'channel_page.dart';
|
||||||
import 'routes/routes.dart';
|
import '../routes/routes.dart';
|
||||||
|
|
||||||
class GroupChatDetailsScreen extends StatefulWidget {
|
class GroupChatDetailsScreen extends StatefulWidget {
|
||||||
final List<User>? selectedUsers;
|
final List<User>? selectedUsers;
|
||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:collection/collection.dart' show IterableExtension;
|
import 'package:collection/collection.dart' show IterableExtension;
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/pages/channel_file_display_screen.dart';
|
||||||
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
import 'channel_file_display_screen.dart';
|
|
||||||
import 'channel_media_display_screen.dart';
|
import 'channel_media_display_screen.dart';
|
||||||
import 'channel_page.dart';
|
import 'channel_page.dart';
|
||||||
import 'chat_info_screen.dart';
|
import 'chat_info_screen.dart';
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:example/channel_page.dart';
|
import 'package:example/pages/channel_page.dart';
|
||||||
import 'package:example/notifications_service.dart';
|
import 'package:example/utils/notifications_service.dart';
|
||||||
import 'package:example/routes/app_routes.dart';
|
import 'package:example/routes/app_routes.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
+3
-3
@@ -1,12 +1,12 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
import 'channel_page.dart';
|
import 'channel_page.dart';
|
||||||
import 'chips_input_text_field.dart';
|
import '../widgets/chips_input_text_field.dart';
|
||||||
import 'routes/routes.dart';
|
import '../routes/routes.dart';
|
||||||
|
|
||||||
class NewChatScreen extends StatefulWidget {
|
class NewChatScreen extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
+3
-4
@@ -1,11 +1,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
import 'routes/routes.dart';
|
import '../routes/routes.dart';
|
||||||
import 'search_text_field.dart';
|
import '../widgets/search_text_field.dart';
|
||||||
|
|
||||||
class NewGroupChatScreen extends StatefulWidget {
|
class NewGroupChatScreen extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@@ -251,7 +251,6 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
|||||||
onPanDown: (_) => FocusScope.of(context).unfocus(),
|
onPanDown: (_) => FocusScope.of(context).unfocus(),
|
||||||
child: StreamUserListView(
|
child: StreamUserListView(
|
||||||
controller: userListController,
|
controller: userListController,
|
||||||
// groupAlphabetically: _isSearchActive ? false : true,
|
|
||||||
itemBuilder: (context, items, index, defaultWidget) {
|
itemBuilder: (context, items, index, defaultWidget) {
|
||||||
return defaultWidget.copyWith(
|
return defaultWidget.copyWith(
|
||||||
selected: _selectedUsers.contains(items[index]),
|
selected: _selectedUsers.contains(items[index]),
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:example/channel_list_page.dart';
|
import 'package:example/pages/channel_list_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
import '../advanced_options_page.dart';
|
import '../app.dart';
|
||||||
import '../channel_page.dart';
|
import '../pages/advanced_options_page.dart';
|
||||||
import '../chat_info_screen.dart';
|
import '../pages/channel_page.dart';
|
||||||
import '../choose_user_page.dart';
|
import '../pages/chat_info_screen.dart';
|
||||||
import '../group_chat_details_screen.dart';
|
import '../pages/choose_user_page.dart';
|
||||||
import '../group_info_screen.dart';
|
import '../pages/group_chat_details_screen.dart';
|
||||||
import '../home_page.dart';
|
import '../pages/group_info_screen.dart';
|
||||||
import '../main.dart';
|
import '../pages/home_page.dart';
|
||||||
import '../new_chat_screen.dart';
|
import '../pages/new_chat_screen.dart';
|
||||||
import '../new_group_chat_screen.dart';
|
import '../pages/new_group_chat_screen.dart';
|
||||||
import '../thread_page.dart';
|
import '../pages/thread_page.dart';
|
||||||
import 'routes.dart';
|
import 'routes.dart';
|
||||||
|
|
||||||
class AppRoutes {
|
class AppRoutes {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/// Define all the route names here
|
/// Application routes
|
||||||
class Routes {
|
abstract class Routes {
|
||||||
static const String APP = '/app';
|
static const String APP = '/app';
|
||||||
static const String HOME = '/home';
|
static const String HOME = '/home';
|
||||||
static const String CHOOSE_USER = '/choose_user';
|
static const String CHOOSE_USER = '/choose_user';
|
||||||
|
|||||||
+3
@@ -1,5 +1,8 @@
|
|||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
|
const sentryDsn =
|
||||||
|
'https://6381ef88de4140db8f5e25ab37e0f08c@o1213503.ingest.sentry.io/6352870';
|
||||||
|
|
||||||
const kDefaultStreamApiKey = 'kv7mcsxr24p8';
|
const kDefaultStreamApiKey = 'kv7mcsxr24p8';
|
||||||
|
|
||||||
final defaultUsers = <String, User>{
|
final defaultUsers = <String, User>{
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import 'package:example/channel_page.dart';
|
import 'package:example/pages/channel_page.dart';
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart'
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart'
|
||||||
+5
-5
@@ -1,16 +1,16 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:example/routes/routes.dart';
|
import 'package:example/routes/routes.dart';
|
||||||
import 'package:example/search_text_field.dart';
|
import 'package:example/widgets/search_text_field.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
|
|
||||||
import 'channel_page.dart';
|
import '../pages/channel_page.dart';
|
||||||
import 'chat_info_screen.dart';
|
import '../pages/chat_info_screen.dart';
|
||||||
import 'group_info_screen.dart';
|
import '../pages/group_info_screen.dart';
|
||||||
|
|
||||||
class ChannelList extends StatefulWidget {
|
class ChannelList extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import 'package:example/localizations.dart';
|
import 'package:example/utils/localizations.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:yaml/yaml.dart';
|
import 'package:yaml/yaml.dart';
|
||||||
Reference in New Issue
Block a user