Skip to content

Commit

Permalink
refactor modularstate
Browse files Browse the repository at this point in the history
  • Loading branch information
RoxyRoses authored and shonorio committed Jan 13, 2025
1 parent 13ca6db commit 9efb42b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:flutter_svg/svg.dart';

import '../../../../shared/design_system/colors.dart';
Expand All @@ -15,13 +14,17 @@ import '../pages/channel/chat_channel_message_page.dart';
import 'chat_channel_controller.dart';

class ChatPage extends StatefulWidget {
const ChatPage({Key? key}) : super(key: key);
const ChatPage({Key? key, required this.controller}) : super(key: key);

final ChatChannelController controller;

@override
_ChatPageState createState() => _ChatPageState();
}

class _ChatPageState extends ModularState<ChatPage, ChatChannelController> {
class _ChatPageState extends State<ChatPage> {
ChatChannelController get controller => widget.controller;

@override
Widget build(BuildContext context) {
return Observer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,16 @@ class MainboardModule extends Module {
List<ModularRoute> get chat => [
ChildRoute(
'/chat/:token',
child: (context, args) => const ChatPage(),
child: (context, args) => ChatPage(
controller: Modular.get<ChatChannelController>(),
),
transition: TransitionType.rightToLeft,
),
ChildRoute(
'/chat_from_feed',
child: (context, args) => const ChatPage(),
child: (context, args) => ChatPage(
controller: Modular.get<ChatChannelController>(),
),
transition: TransitionType.noTransition,
),
];
Expand Down

0 comments on commit 9efb42b

Please sign in to comment.