fix light theme on ios
This commit is contained in:
@@ -58,8 +58,6 @@
|
|||||||
<array>
|
<array>
|
||||||
<string>remote-notification</string>
|
<string>remote-notification</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UIUserInterfaceStyle</key>
|
|
||||||
<string>Light</string>
|
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -59,7 +59,10 @@ class MyApp extends StatelessWidget {
|
|||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
theme: ThemeData.light(),
|
theme: ThemeData.light(),
|
||||||
darkTheme: ThemeData.dark(),
|
darkTheme: ThemeData.dark(),
|
||||||
themeMode: ThemeMode.system,
|
themeMode:
|
||||||
|
WidgetsBinding.instance.window.platformBrightness == Brightness.light
|
||||||
|
? ThemeMode.light
|
||||||
|
: ThemeMode.dark,
|
||||||
onGenerateRoute: AppRoutes.generateRoute,
|
onGenerateRoute: AppRoutes.generateRoute,
|
||||||
initialRoute:
|
initialRoute:
|
||||||
client.state.user == null ? Routes.CHOOSE_USER : Routes.HOME,
|
client.state.user == null ? Routes.CHOOSE_USER : Routes.HOME,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: example
|
name: example
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
version: 1.0.105+108
|
version: 1.0.106+109
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.2.2 <3.0.0"
|
sdk: ">=2.2.2 <3.0.0"
|
||||||
|
|||||||
@@ -173,10 +173,10 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
bool _showScrollToBottom = false;
|
bool _showScrollToBottom = false;
|
||||||
ItemPositionsListener _itemPositionListener;
|
ItemPositionsListener _itemPositionListener;
|
||||||
int _messageListLength;
|
int _messageListLength;
|
||||||
|
StreamChannelState streamChannel;
|
||||||
|
|
||||||
int get _initialIndex {
|
int get _initialIndex {
|
||||||
if (widget.initialScrollIndex != null) return widget.initialScrollIndex;
|
if (widget.initialScrollIndex != null) return widget.initialScrollIndex;
|
||||||
final streamChannel = StreamChannel.of(context);
|
|
||||||
if (streamChannel.initialMessageId != null) {
|
if (streamChannel.initialMessageId != null) {
|
||||||
final messages = streamChannel.channel.state.messages;
|
final messages = streamChannel.channel.state.messages;
|
||||||
final totalMessages = messages.length;
|
final totalMessages = messages.length;
|
||||||
@@ -196,11 +196,10 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool _isInitialMessage(String id) {
|
bool _isInitialMessage(String id) {
|
||||||
final streamChannel = StreamChannel.of(context);
|
|
||||||
return streamChannel.initialMessageId == id;
|
return streamChannel.initialMessageId == id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get _upToDate => StreamChannel.of(context).channel.state.isUpToDate;
|
bool get _upToDate => streamChannel.channel.state.isUpToDate;
|
||||||
|
|
||||||
bool _topPaginationActive = false;
|
bool _topPaginationActive = false;
|
||||||
bool _bottomPaginationActive = false;
|
bool _bottomPaginationActive = false;
|
||||||
@@ -216,22 +215,13 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final streamChannel = StreamChannel.of(context);
|
|
||||||
|
|
||||||
final messagesStream = widget.parentMessage != null
|
final messagesStream = widget.parentMessage != null
|
||||||
? streamChannel.channel.state.threadsStream
|
? streamChannel.channel.state.threadsStream
|
||||||
.where((threads) => threads.containsKey(widget.parentMessage.id))
|
.where((threads) => threads.containsKey(widget.parentMessage.id))
|
||||||
.map((threads) => threads[widget.parentMessage.id])
|
.map((threads) => threads[widget.parentMessage.id])
|
||||||
: streamChannel.channel.state?.messagesStream;
|
: streamChannel.channel.state?.messagesStream;
|
||||||
|
|
||||||
return WillPopScope(
|
return StreamBuilder<List<Message>>(
|
||||||
onWillPop: () async {
|
|
||||||
if (!_upToDate) {
|
|
||||||
await streamChannel.reloadChannel();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
child: StreamBuilder<List<Message>>(
|
|
||||||
stream: messagesStream?.map((messages) => messages
|
stream: messagesStream?.map((messages) => messages
|
||||||
?.where((e) =>
|
?.where((e) =>
|
||||||
!e.isDeleted ||
|
!e.isDeleted ||
|
||||||
@@ -428,8 +418,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
messageWidget,
|
messageWidget,
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||||
const EdgeInsets.symmetric(vertical: 12.0),
|
|
||||||
child: widget.dateDividerBuilder != null
|
child: widget.dateDividerBuilder != null
|
||||||
? widget.dateDividerBuilder(
|
? widget.dateDividerBuilder(
|
||||||
nextMessage.createdAt.toLocal())
|
nextMessage.createdAt.toLocal())
|
||||||
@@ -478,8 +467,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _paginateData(
|
Future<void> _paginateData(
|
||||||
@@ -499,7 +487,6 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildScrollToBottom() {
|
Widget _buildScrollToBottom() {
|
||||||
final streamChannel = StreamChannel.of(context);
|
|
||||||
return StreamBuilder<Tuple2<bool, int>>(
|
return StreamBuilder<Tuple2<bool, int>>(
|
||||||
stream: Rx.combineLatest2(
|
stream: Rx.combineLatest2(
|
||||||
streamChannel.channel.state.isUpToDateStream,
|
streamChannel.channel.state.isUpToDateStream,
|
||||||
@@ -744,7 +731,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
final isNextUser =
|
final isNextUser =
|
||||||
index - 2 >= 0 && message.user.id == messages[index - 2]?.user?.id;
|
index - 2 >= 0 && message.user.id == messages[index - 2]?.user?.id;
|
||||||
|
|
||||||
final channel = StreamChannel.of(context).channel;
|
final channel = streamChannel.channel;
|
||||||
final readList = channel.state?.read
|
final readList = channel.state?.read
|
||||||
?.where((element) => element.user.id != userId)
|
?.where((element) => element.user.id != userId)
|
||||||
?.where((read) =>
|
?.where((read) =>
|
||||||
@@ -836,7 +823,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
_itemPositionListener =
|
_itemPositionListener =
|
||||||
widget.itemPositionListener ?? ItemPositionsListener.create();
|
widget.itemPositionListener ?? ItemPositionsListener.create();
|
||||||
|
|
||||||
final streamChannel = StreamChannel.of(context);
|
streamChannel = StreamChannel.of(context);
|
||||||
|
|
||||||
initialIndex = _initialIndex;
|
initialIndex = _initialIndex;
|
||||||
initialAlignment = _initialAlignment;
|
initialAlignment = _initialAlignment;
|
||||||
@@ -879,16 +866,13 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (_) {
|
MaterialPageRoute(builder: (_) {
|
||||||
return StreamBuilder<Message>(
|
return StreamBuilder<Message>(
|
||||||
stream: StreamChannel.of(context)
|
stream: streamChannel.channel.state.messagesStream.map(
|
||||||
.channel
|
(messages) =>
|
||||||
.state
|
|
||||||
.messagesStream
|
|
||||||
.map((messages) =>
|
|
||||||
messages.firstWhere((m) => m.id == message.id)),
|
messages.firstWhere((m) => m.id == message.id)),
|
||||||
initialData: message,
|
initialData: message,
|
||||||
builder: (_, snapshot) {
|
builder: (_, snapshot) {
|
||||||
return StreamChannel(
|
return StreamChannel(
|
||||||
channel: StreamChannel.of(context).channel,
|
channel: streamChannel.channel,
|
||||||
child: widget.threadBuilder(context, snapshot.data),
|
child: widget.threadBuilder(context, snapshot.data),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -900,6 +884,9 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
if (!_upToDate) {
|
||||||
|
streamChannel.reloadChannel();
|
||||||
|
}
|
||||||
_messageNewListener?.cancel();
|
_messageNewListener?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user