Reduced the code
This commit is contained in:
@@ -61,75 +61,37 @@ The second type looks like this:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
We can use a `Stack` for achieving this, here's a complete working implementation:
|
We can use a `Stack` for achieving this:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
class MyApp extends StatelessWidget {
|
Stack(
|
||||||
const MyApp({
|
children: <Widget>[
|
||||||
Key? key,
|
// Add your video implementation here
|
||||||
required this.client,
|
ShaderMask(
|
||||||
required this.channel,
|
shaderCallback: (rect) {
|
||||||
}) : super(key: key);
|
return const LinearGradient(
|
||||||
|
begin: Alignment.bottomCenter,
|
||||||
final StreamChatClient client;
|
end: Alignment.topCenter,
|
||||||
|
colors: [Colors.black, Colors.transparent],
|
||||||
final Channel channel;
|
stops: [0.4, 0.8]).createShader(
|
||||||
|
Rect.fromLTRB(0, 0, rect.width, rect.height),
|
||||||
@override
|
);
|
||||||
Widget build(BuildContext context) => MaterialApp(
|
},
|
||||||
theme: ThemeData.light(),
|
blendMode: BlendMode.dstIn,
|
||||||
darkTheme: ThemeData.dark(),
|
child: Column(
|
||||||
builder: (context, widget) => StreamChat(
|
children: const [
|
||||||
client: client,
|
Expanded(
|
||||||
child: widget,
|
child: MessageListViewTheme(
|
||||||
streamChatThemeData: StreamChatThemeData().copyWith(
|
data: MessageListViewThemeData(
|
||||||
messageListViewTheme: const MessageListViewThemeData(
|
backgroundColor: Colors.transparent,
|
||||||
backgroundColor: Colors.transparent,
|
),
|
||||||
),
|
child: MessageListView(),
|
||||||
),
|
|
||||||
),
|
|
||||||
home: StreamChannel(
|
|
||||||
channel: channel,
|
|
||||||
child: const ChannelPage(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ChannelPage extends StatelessWidget {
|
|
||||||
const ChannelPage({
|
|
||||||
Key? key,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
body: Stack(
|
|
||||||
children: <Widget>[
|
|
||||||
// Add your video implementation here
|
|
||||||
ShaderMask(
|
|
||||||
shaderCallback: (rect) {
|
|
||||||
return const LinearGradient(
|
|
||||||
begin: Alignment.bottomCenter,
|
|
||||||
end: Alignment.topCenter,
|
|
||||||
colors: [Colors.black, Colors.transparent],
|
|
||||||
stops: [0.4, 0.8]).createShader(
|
|
||||||
Rect.fromLTRB(0, 0, rect.width, rect.height),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
blendMode: BlendMode.dstIn,
|
|
||||||
child: Column(
|
|
||||||
children: const [
|
|
||||||
Expanded(
|
|
||||||
child: MessageListView(),
|
|
||||||
),
|
|
||||||
MessageInput(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
MessageInput(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
}
|
],
|
||||||
}
|
),
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user