feat: adding nest navigators for each tab
parent
2638fede0b
commit
d86f4328ff
|
@ -0,0 +1,33 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
import "./widgets/home_view.dart";
|
||||
|
||||
class ContactTab extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ContactTabState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ContactTabState extends State<ContactTab> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Navigator(
|
||||
initialRoute: "conversation/home",
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
WidgetBuilder builder;
|
||||
switch (settings.name) {
|
||||
case "conversation/home":
|
||||
builder = (BuildContext _) => HomeView();
|
||||
break;
|
||||
case "conversation/new":
|
||||
builder = (BuildContext _) => Center(child: Text("SOON"));
|
||||
break;
|
||||
default:
|
||||
throw Exception("Invalid route: ${settings.name}");
|
||||
}
|
||||
return MaterialPageRoute(builder: builder, settings: settings);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
import "package:flutter/material.dart";
|
||||
import 'package:sticky_headers/sticky_headers.dart';
|
||||
|
||||
import "../../models/user_model.dart";
|
||||
import "../../blocs/contact_bloc.dart";
|
||||
import "../../../models/user_model.dart";
|
||||
import "../../../blocs/contact_bloc.dart";
|
||||
|
||||
import "./widgets/contact_item.dart";
|
||||
import "../widgets/search_input.dart";
|
||||
import "../widgets/contact_item.dart";
|
||||
import "../../widgets/search_input.dart";
|
||||
|
||||
class ContactView extends StatefulWidget {
|
||||
class HomeView extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ContactViewState();
|
||||
return _HomeViewState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ContactViewState extends State<ContactView> {
|
||||
class _HomeViewState extends State<HomeView> {
|
||||
final searchController = TextEditingController();
|
||||
|
||||
@override
|
|
@ -0,0 +1,33 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
import "./widgets/home_view.dart";
|
||||
|
||||
class ConversationTab extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ConversationTabState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ConversationTabState extends State<ConversationTab> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Navigator(
|
||||
initialRoute: "conversation/home",
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
WidgetBuilder builder;
|
||||
switch (settings.name) {
|
||||
case "conversation/home":
|
||||
builder = (BuildContext _) => HomeView();
|
||||
break;
|
||||
case "conversation/new":
|
||||
builder = (BuildContext _) => Center(child: Text("SOON"));
|
||||
break;
|
||||
default:
|
||||
throw Exception("Invalid route: ${settings.name}");
|
||||
}
|
||||
return MaterialPageRoute(builder: builder, settings: settings);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
import "../../models/conversation_model.dart";
|
||||
import "../../blocs/conversation_bloc.dart";
|
||||
import "../../../models/conversation_model.dart";
|
||||
import "../../../blocs/conversation_bloc.dart";
|
||||
|
||||
import "./widgets/conversation_item.dart";
|
||||
import "../widgets/search_input.dart";
|
||||
import "../widgets/conversation_item.dart";
|
||||
import "../../widgets/search_input.dart";
|
||||
|
||||
class ConversationView extends StatefulWidget {
|
||||
class HomeView extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _ConversationViewState();
|
||||
return _HomeViewState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ConversationViewState extends State<ConversationView> {
|
||||
class _HomeViewState extends State<HomeView> {
|
||||
final searchController = TextEditingController();
|
||||
|
||||
@override
|
|
@ -2,8 +2,8 @@ import "package:flutter/material.dart";
|
|||
import 'dart:ui' as ui;
|
||||
|
||||
import "./widgets/top_bar.dart";
|
||||
import "./conversation_view/conversation_view.dart";
|
||||
import "./contact_view/contact_view.dart";
|
||||
import "./conversation_tab/conversation_tab.dart";
|
||||
import "./contact_tab/contact_tab.dart";
|
||||
import "./bottom_bar/bottom_bar.dart";
|
||||
import "../services/heartbeat_manager.dart";
|
||||
import "../services/conversation_manager.dart";
|
||||
|
@ -80,8 +80,8 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
|
|||
physics: NeverScrollableScrollPhysics(),
|
||||
controller: controller,
|
||||
children: <Widget>[
|
||||
ContactView(),
|
||||
ConversationView(),
|
||||
ContactTab(),
|
||||
ConversationTab(),
|
||||
Container(),
|
||||
])),
|
||||
]),
|
||||
|
|
Loading…
Reference in New Issue