Commit 07d7d24b authored by Wilko Manger's avatar Wilko Manger

Adhere to and enforce Effective Dart

With a few exceptions.
parent 44914394
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see https://github.com/dart-lang/pedantic#enabled-lints.
include: package:pedantic/analysis_options.yaml
include: package:effective_dart/analysis_options.yaml
analyzer:
errors:
missing_required_param: error
\ No newline at end of file
missing_required_param: error
exclude:
- lib/src/resources/intl/messages*.dart
linter:
rules:
public_member_api_docs: false
directives_ordering: false
\ No newline at end of file
......@@ -6,3 +6,8 @@ mv lib/src/resources/intl/intl_messages.arb lib/src/resources/intl/intl_en.arb
flutter pub run intl_translation:generate_from_arb \
--output-dir=lib/src/resources/intl --no-use-deferred-loading \
lib/src/resources/intl/localizations.dart lib/src/resources/intl/*.arb
echo '// ignore_for_file: avoid_catches_without_on_clauses,type_annotate_public_apis,lines_longer_than_80_chars' \
| tee -a lib/src/resources/intl/messages*.dart
dartfmt lib/src/resources/intl/messages*.dart -w --fix
......@@ -20,14 +20,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:pattle/src/redirect.dart';
import 'package:provider/provider.dart';
import 'auth/bloc.dart';
import 'matrix.dart';
import 'auth/bloc.dart';
import 'sentry/bloc.dart';
import 'notifications/bloc.dart';
import 'resources/intl/localizations.dart';
import 'resources/theme.dart';
import 'section/main/chat/page.dart';
import 'section/main/chat/image/page.dart';
import 'section/main/chat/settings/page.dart';
......@@ -42,59 +43,60 @@ import 'section/main/settings/page.dart';
import 'section/start/advanced_page.dart';
import 'section/start/start_page.dart';
import 'section/start/login/username/page.dart';
import 'sentry/bloc.dart';
final routes = {
Routes.root: (Object params) => MaterialPageRoute(
import 'redirect.dart';
final Map<String, MaterialPageRoute Function(Object)> routes = {
Routes.root: (params) => MaterialPageRoute(
settings: RouteSettings(name: Routes.root),
builder: (context) => Redirect(),
),
Routes.settings: (Object params) => MaterialPageRoute(
Routes.settings: (params) => MaterialPageRoute(
settings: RouteSettings(name: Routes.settings),
builder: (context) => SettingsPage.withBloc(),
),
Routes.settingsProfile: (Object params) => MaterialPageRoute(
Routes.settingsProfile: (params) => MaterialPageRoute(
settings: RouteSettings(name: Routes.settingsProfile),
builder: (context) => ProfilePage.withGivenBloc(params),
),
Routes.settingsProfileName: (Object params) => MaterialPageRoute(
Routes.settingsProfileName: (params) => MaterialPageRoute(
settings: RouteSettings(name: Routes.settingsProfileName),
builder: (context) => NamePage.withGivenBloc(params),
),
Routes.settingsAppearance: (Object params) => MaterialPageRoute(
Routes.settingsAppearance: (params) => MaterialPageRoute(
settings: RouteSettings(name: Routes.settingsAppearance),
builder: (context) => AppearancePage.withGivenBloc(params),
),
Routes.chats: (Object arguments) => MaterialPageRoute(
Routes.chats: (arguments) => MaterialPageRoute(
settings: RouteSettings(name: Routes.chats),
builder: (context) => arguments is Chat
? ChatPage.withBloc(arguments)
: ChatsPage.withBloc(),
),
Routes.chatsSettings: (Object arguments) => MaterialPageRoute(
Routes.chatsSettings: (arguments) => MaterialPageRoute(
settings: RouteSettings(name: Routes.chatsSettings),
builder: (context) => ChatSettingsPage.withBloc(arguments),
),
Routes.chatsNew: (Object arguments) => MaterialPageRoute(
Routes.chatsNew: (arguments) => MaterialPageRoute(
settings: RouteSettings(name: Routes.chatsNew),
builder: (context) => CreateGroupMembersPage.withBloc(),
),
Routes.chatsNewDetails: (Object arguments) => MaterialPageRoute(
Routes.chatsNewDetails: (arguments) => MaterialPageRoute(
settings: RouteSettings(name: Routes.chatsNewDetails),
builder: (context) => CreateGroupDetailsPage.withGivenBloc(arguments),
),
Routes.image: (Object arguments) => MaterialPageRoute(
Routes.image: (arguments) => MaterialPageRoute(
settings: RouteSettings(name: Routes.image),
builder: (context) => ImagePage.withBloc(arguments)),
Routes.login: (Object params) => MaterialPageRoute(
Routes.login: (params) => MaterialPageRoute(
settings: RouteSettings(name: Routes.login),
builder: (context) => StartPage(),
),
Routes.loginAdvanced: (Object params) => MaterialPageRoute(
Routes.loginAdvanced: (params) => MaterialPageRoute(
settings: RouteSettings(name: Routes.loginAdvanced),
builder: (context) => AdvancedPage(bloc: params),
),
Routes.loginUsername: (Object params) => MaterialPageRoute(
Routes.loginUsername: (params) => MaterialPageRoute(
settings: RouteSettings(name: Routes.loginUsername),
builder: (context) => UsernameLoginPage.withBloc(),
),
......@@ -148,15 +150,14 @@ class App extends StatelessWidget {
child: Provider<Matrix>(
create: (_) => Matrix(_authBloc),
child: Builder(
builder: (BuildContext c) {
builder: (c) {
return BlocProvider<NotificationsBloc>(
create: (context) => NotificationsBloc(
matrix: Matrix.of(c),
authBloc: _authBloc,
),
child: MaterialApp(
onGenerateTitle: (BuildContext context) =>
context.intl.appName,
onGenerateTitle: (context) => context.intl.appName,
localizationsDelegates: [
const PattleLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
......
......@@ -18,11 +18,12 @@
import 'package:flutter/material.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:matrix_sdk_sqflite/matrix_sdk_sqflite.dart';
import 'package:pattle/src/auth/bloc.dart';
import 'package:provider/provider.dart';
import 'auth/bloc.dart';
class Matrix {
static final store = SqfliteStore(path: 'pattle.sqlite');
static final SqfliteStore store = SqfliteStore(path: 'pattle.sqlite');
// Used for listening to auth state changes
final AuthBloc _authBloc;
......
......@@ -24,8 +24,9 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:meta/meta.dart';
import 'package:bloc/bloc.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/section/main/chats/models/chat.dart';
import 'package:pattle/src/section/main/models/chat_member.dart';
import '../section/main/chats/models/chat.dart';
import '../section/main/models/chat_member.dart';
import '../auth/bloc.dart';
import '../matrix.dart';
......
{
"@@last_modified": "2020-03-22T18:31:30.071193",
"@@last_modified": "2020-03-23T21:58:49.230276",
"appName": "Pattle",
"@appName": {
"type": "text",
......@@ -81,6 +81,11 @@
"type": "text",
"placeholders": {}
},
"_Start_reportErrorsDescription": "Allow Pattle to send crash reports to help development",
"@_Start_reportErrorsDescription": {
"type": "text",
"placeholders": {}
},
"_StartUsername_title": "Enter username",
"@_StartUsername_title": {
"type": "text",
......@@ -226,11 +231,6 @@
"count": {}
}
},
"Participants": "Participants",
"@Participants": {
"type": "text",
"placeholders": {}
},
"_ChatDetails_participants": "{count,plural, =0{No participants}=1{{count} participant}other{{count} participants}}",
"@_ChatDetails_participants": {
"type": "text",
......@@ -258,6 +258,11 @@
"type": "text",
"placeholders": {}
},
"Participants": "Participants",
"@Participants": {
"type": "text",
"placeholders": {}
},
"_Settings_title": "Settings",
"@_Settings_title": {
"description": "Settings page title",
......
......@@ -17,7 +17,8 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:pattle/src/section/main/models/chat_member.dart';
import '../../section/main/models/chat_member.dart';
import 'messages_all.dart';
......@@ -30,9 +31,9 @@ class PattleLocalizationsDelegate
@override
Future<PattleLocalizations> load(Locale locale) {
final String name =
final name =
locale.countryCode.isEmpty ? locale.languageCode : locale.toString();
final String localeName = Intl.canonicalizedLocale(name);
final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
print('mjam');
return PattleLocalizations(localeName);
......@@ -96,12 +97,12 @@ List<TextSpan> _toTextSpans({
if (args.length >= 2) placeholders[1],
]);
final placeholderPositions = Map<int, String>();
final placeholderPositions = <int, String>{};
for (final placeholder in placeholders) {
final split = message.split(placeholder);
int i = 0;
var i = 0;
for (final string in split) {
if (string != split.last) {
placeholderPositions[i] = placeholder;
......@@ -174,6 +175,7 @@ extension LocalizedTextSpansBool on String Function(
String,
) {
List<TextSpan> toTextSpans(
// ignore: avoid_positional_boolean_parameters
bool condition,
String firstName,
String secondName, {
......@@ -356,6 +358,14 @@ class _Start extends _Category {
locale: _localeName,
);
}
String get reportErrorsDescription {
return Intl.message(
'Allow Pattle to send crash reports to help development',
name: '_Start_reportErrorsDescription',
locale: _localeName,
);
}
}
class _StartUsername extends _Category {
......@@ -454,6 +464,7 @@ class _Chat extends _Category {
);
}
// ignore: avoid_positional_boolean_parameters
String areTyping(bool andMore, String first, String second) {
return Intl.select(
andMore,
......
......@@ -17,9 +17,9 @@ import 'package:intl/src/intl_helpers.dart';
import 'messages_en.dart' as messages_en;
typedef Future<dynamic> LibraryLoader();
typedef LibraryLoader = Future<dynamic> Function();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new Future.value(null),
'en': () => Future.value(null),
};
MessageLookupByLibrary _findExact(String localeName) {
......@@ -34,17 +34,16 @@ MessageLookupByLibrary _findExact(String localeName) {
/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale(
localeName,
(locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new Future.value(false);
return Future.value(false);
}
var lib = _deferredLibraries[availableLocale];
await (lib == null ? new Future.value(false) : lib());
initializeInternalMessageLookup(() => new CompositeMessageLookup());
await (lib == null ? Future.value(false) : lib());
initializeInternalMessageLookup(() => CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new Future.value(true);
return Future.value(true);
}
bool _messagesExistFor(String locale) {
......@@ -56,8 +55,9 @@ bool _messagesExistFor(String locale) {
}
MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null);
var actualLocale =
Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}
// ignore_for_file: avoid_catches_without_on_clauses,type_annotate_public_apis,lines_longer_than_80_chars
This diff is collapsed.
......@@ -35,98 +35,17 @@ final _theme = ThemeData(
),
);
final lightTheme = _theme.copyWith(
final ThemeData lightTheme = _theme.copyWith(
brightness: Brightness.light,
);
final darkTheme = ThemeData.dark().merge(_theme).copyWith(
//brightness: Brightness.dark,
toggleableActiveColor: LightColors.red[400],
textSelectionHandleColor: LightColors.red[400],
);
final ThemeData darkTheme = _theme.copyWith(
//brightness: Brightness.dark,
toggleableActiveColor: LightColors.red[400],
textSelectionHandleColor: LightColors.red[400],
);
extension Themes on ThemeData {
ThemeData merge(ThemeData other) {
return this.copyWith(
brightness: other.brightness ?? this.brightness,
primaryColor: other.primaryColor ?? this.primaryColor,
primaryColorBrightness:
other.primaryColorBrightness ?? this.primaryColorBrightness,
primaryColorLight: other.primaryColorLight ?? this.primaryColorLight,
primaryColorDark: other.primaryColorDark ?? this.primaryColorDark,
accentColor: other.accentColor ?? this.accentColor,
accentColorBrightness:
other.accentColorBrightness ?? this.accentColorBrightness,
canvasColor: other.canvasColor ?? this.canvasColor,
scaffoldBackgroundColor:
other.scaffoldBackgroundColor ?? this.scaffoldBackgroundColor,
bottomAppBarColor: other.bottomAppBarColor ?? this.bottomAppBarColor,
cardColor: other.cardColor ?? this.cardColor,
dividerColor: other.dividerColor ?? this.dividerColor,
focusColor: other.focusColor ?? this.focusColor,
hoverColor: other.hoverColor ?? this.hoverColor,
highlightColor: other.highlightColor ?? this.highlightColor,
splashColor: other.splashColor ?? this.splashColor,
splashFactory: other.splashFactory ?? this.splashFactory,
selectedRowColor: other.selectedRowColor ?? this.selectedRowColor,
unselectedWidgetColor:
other.unselectedWidgetColor ?? this.unselectedWidgetColor,
disabledColor: other.disabledColor ?? this.disabledColor,
buttonColor: other.buttonColor ?? this.buttonColor,
buttonTheme: other.buttonTheme ?? this.buttonTheme,
toggleButtonsTheme: other.toggleButtonsTheme ?? this.toggleButtonsTheme,
secondaryHeaderColor:
other.secondaryHeaderColor ?? this.secondaryHeaderColor,
textSelectionColor: other.textSelectionColor ?? this.textSelectionColor,
cursorColor: other.cursorColor ?? this.cursorColor,
textSelectionHandleColor:
other.textSelectionHandleColor ?? this.textSelectionHandleColor,
backgroundColor: other.backgroundColor ?? this.backgroundColor,
dialogBackgroundColor:
other.dialogBackgroundColor ?? this.dialogBackgroundColor,
indicatorColor: other.indicatorColor ?? this.indicatorColor,
hintColor: other.hintColor ?? this.hintColor,
errorColor: other.errorColor ?? this.errorColor,
toggleableActiveColor:
other.toggleableActiveColor ?? this.toggleableActiveColor,
textTheme: other.textTheme ?? this.textTheme,
primaryTextTheme: other.primaryTextTheme ?? this.primaryTextTheme,
accentTextTheme: other.accentTextTheme ?? this.accentTextTheme,
inputDecorationTheme:
other.inputDecorationTheme ?? this.inputDecorationTheme,
iconTheme: other.iconTheme ?? this.iconTheme,
primaryIconTheme: other.primaryIconTheme ?? this.primaryIconTheme,
accentIconTheme: other.accentIconTheme ?? this.accentIconTheme,
sliderTheme: other.sliderTheme ?? this.sliderTheme,
tabBarTheme: other.tabBarTheme ?? this.tabBarTheme,
tooltipTheme: other.tooltipTheme ?? this.tooltipTheme,
cardTheme: other.cardTheme ?? this.cardTheme,
chipTheme: other.chipTheme ?? this.chipTheme,
platform: other.platform ?? this.platform,
materialTapTargetSize:
other.materialTapTargetSize ?? this.materialTapTargetSize,
applyElevationOverlayColor:
other.applyElevationOverlayColor ?? this.applyElevationOverlayColor,
pageTransitionsTheme:
other.pageTransitionsTheme ?? this.pageTransitionsTheme,
appBarTheme: other.appBarTheme ?? this.appBarTheme,
bottomAppBarTheme: other.bottomAppBarTheme ?? this.bottomAppBarTheme,
colorScheme: other.colorScheme ?? this.colorScheme,
dialogTheme: other.dialogTheme ?? this.dialogTheme,
floatingActionButtonTheme:
other.floatingActionButtonTheme ?? this.floatingActionButtonTheme,
typography: other.typography ?? this.typography,
cupertinoOverrideTheme:
other.cupertinoOverrideTheme ?? this.cupertinoOverrideTheme,
snackBarTheme: other.snackBarTheme ?? this.snackBarTheme,
bottomSheetTheme: other.bottomSheetTheme ?? this.bottomSheetTheme,
popupMenuTheme: other.popupMenuTheme ?? this.popupMenuTheme,
bannerTheme: other.bannerTheme ?? this.bannerTheme,
dividerTheme: other.dividerTheme ?? this.dividerTheme,
buttonBarTheme: other.buttonBarTheme ?? this.buttonBarTheme,
);
}
Widget withTransparentAppBar({@required Widget child}) => Builder(
builder: (context) {
return Theme(
......
......@@ -22,17 +22,17 @@ import 'package:bloc/bloc.dart';
import 'package:image/image.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:mime/mime.dart';
import 'package:pattle/src/section/main/chat/event.dart';
import 'package:pattle/src/section/main/models/chat_message.dart';
import '../models/chat_message.dart';
import '../../../matrix.dart';
import '../../../util/room.dart';
import 'event.dart';
export 'event.dart';
import 'state.dart';
export 'state.dart';
export 'event.dart';
class ChatBloc extends Bloc<ChatEvent, ChatState> {
final Matrix matrix;
......@@ -120,7 +120,7 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
}
Future<ChatState> _fetch() async {
final currentState = this.state;
final currentState = state;
int page;
if (currentState is ChatLoaded) {
......@@ -131,7 +131,7 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
final events = await room.timeline.paginate(page: page);
final messages = List<ChatMessage>();
final messages = <ChatMessage>[];
RoomEvent event;
for (event in events) {
......
......@@ -18,14 +18,15 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/section/main/models/chat_message.dart';
import '../../models/chat_message.dart';
import '../../../../matrix.dart';
import 'event.dart';
export 'event.dart';
import 'event.dart';
import 'state.dart';
export 'state.dart';
export 'event.dart';
class ImageBloc extends Bloc<ImageEvent, ImageState> {
final Matrix _matrix;
......@@ -46,7 +47,7 @@ class ImageBloc extends Bloc<ImageEvent, ImageState> {
Stream<ImageState> mapEventToState(ImageEvent event) async* {
if (event is FetchImages) {
yield ImagesLoading();
final imageMessageEvents = List<ImageMessageEvent>();
final imageMessageEvents = <ImageMessageEvent>[];
RoomEvent event;
for (event in await _room.timeline.get(allowRemote: false)) {
......
......@@ -19,11 +19,12 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/section/main/models/chat_member.dart';
import 'package:pattle/src/section/main/models/chat_message.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
import '../../models/chat_member.dart';
import '../../models/chat_message.dart';
import '../../../../matrix.dart';
import '../../../../util/date_format.dart';
import '../../../../util/url.dart';
......
import 'package:equatable/equatable.dart';
import 'package:pattle/src/section/main/models/chat_message.dart';
import '../../models/chat_message.dart';
abstract class ImageState extends Equatable {
@override
......
......@@ -22,15 +22,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:image_picker/image_picker.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/app.dart';
import '../../../app.dart';
import 'package:pattle/src/resources/intl/localizations.dart';
import 'package:pattle/src/resources/theme.dart';
import 'package:pattle/src/section/main/chats/models/chat.dart';
import 'package:pattle/src/section/main/chats/widgets/typing_content.dart';
import 'package:pattle/src/section/main/widgets/chat_name.dart';
import 'package:pattle/src/section/main/widgets/error.dart';
import 'package:pattle/src/section/main/widgets/title_with_sub.dart';
import '../../../resources/intl/localizations.dart';
import '../../../resources/theme.dart';
import '../chats/models/chat.dart';
import '../chats/widgets/typing_content.dart';
import '../widgets/chat_name.dart';
import '../widgets/error.dart';
import '../widgets/title_with_sub.dart';
import '../../../matrix.dart';
import '../../../util/color.dart';
......@@ -100,14 +100,6 @@ class _ChatPageState extends State<ChatPage> {
);
}
final settingsGestureDetector = ({Widget child}) {
return GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.chatsSettings, arguments: widget.chat),
child: child,
);
};
// TODO: typingUsers should not contain nulls
Widget title =
_room.isSomeoneElseTyping && !_room.typingUsers.any((u) => u == null)
......@@ -121,7 +113,11 @@ class _ChatPageState extends State<ChatPage> {
backgroundColor: chatBackgroundColor(context),
appBar: AppBar(
titleSpacing: 0,
title: settingsGestureDetector(
title: GestureDetector(
onTap: () => Navigator.of(context).pushNamed(
Routes.chatsSettings,
arguments: widget.chat,
),
child: Row(
children: <Widget>[
avatar,
......@@ -169,7 +165,7 @@ class _MessageList extends StatefulWidget {
}
class _MessageListState extends State<_MessageList> {
ScrollController _scrollController = ScrollController();
final _scrollController = ScrollController();
final double _scrollThreshold = 200;
@override
......@@ -278,7 +274,7 @@ class _Input extends StatefulWidget {
}
class _InputState extends State<_Input> {
TextEditingController _textController = TextEditingController();
final _textController = TextEditingController();
@override
Widget build(BuildContext context) {
......
......@@ -19,13 +19,15 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/section/main/models/chat_member.dart';
import '../../models/chat_member.dart';
import '../../../../matrix.dart';
import 'event.dart';
export 'event.dart';
import 'event.dart';
import 'state.dart';
export 'event.dart';
export 'state.dart';
class ChatSettingsBloc extends Bloc<ChatSettingsEvent, ChatSettingsState> {
......
......@@ -21,16 +21,19 @@ import 'package:flutter/rendering.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/resources/intl/localizations.dart';
import 'package:pattle/src/resources/theme.dart';
import 'package:pattle/src/section/main/chats/models/chat.dart';
import 'package:pattle/src/section/main/models/chat_member.dart';
import 'package:pattle/src/section/main/widgets/chat_name.dart';
import 'package:pattle/src/section/main/widgets/chat_member_tile.dart';
import '../../../../resources/intl/localizations.dart';
import '../../../../resources/theme.dart';
import '../../widgets/chat_name.dart';
import '../../widgets/chat_member_tile.dart';
import '../../chats/models/chat.dart';
import '../../models/chat_member.dart';
import '../../../../matrix.dart';
import '../../../../util/url.dart';
import '../../../../util/color.dart';
import 'bloc.dart';
class ChatSettingsPage extends StatefulWidget {
......@@ -67,7 +70,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
dark: Theme.of(context).backgroundColor,
),
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
headerSliverBuilder: (context, innerBoxIsScrolled) {
final url = widget.chat.avatarUrl?.toDownloadString(context);
return <Widget>[
SliverAppBar(
......@@ -201,7 +204,7 @@ class _MemberListState extends State<_MemberList> {
SizedBox(height: 4),
BlocBuilder<ChatSettingsBloc, ChatSettingsState>(
builder: (context, state) {
var members = List<ChatMember>();
var members = <ChatMember>[];
if (state is MembersLoaded) {
members = state.members;
}
......@@ -221,7 +224,7 @@ class _MemberListState extends State<_MemberList> {
itemCount: (_previewMembers && !allShown) || isLoading
? members.length + 1
: members.length,
itemBuilder: (BuildContext context, int index) {
itemBuilder: (context, index) {
// Item after all members
if (index == members.length) {
return _ShowMoreItem(
......
import 'package:equatable/equatable.dart';
import 'package:pattle/src/section/main/models/chat_member.dart';
import '../../models/chat_member.dart';
abstract class ChatSettingsState extends Equatable {
@override
......
import 'package:equatable/equatable.dart';
import 'package:meta/meta.dart';
import 'package:pattle/src/section/main/models/chat_message.dart';
import '../models/chat_message.dart';
abstract class ChatState extends Equatable {
@override
......@@ -12,7 +13,7 @@ class ChatLoading extends ChatState {}
class ChatLoaded extends ChatState {
final int pageCount;
final List<ChatMessage> messages;
final endReached;
final bool endReached;
ChatLoaded({
@required this.messages,
......
......@@ -18,11 +18,10 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';