friends_page.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import 'package:flutter/material.dart';
  2. import 'widgets/friends_list.dart';
  3. import 'widgets/requests.dart';
  4. class FriendsPage extends StatefulWidget {
  5. const FriendsPage({Key? key}) : super(key: key);
  6. @override
  7. State<FriendsPage> createState() => _FriendsPageState();
  8. }
  9. class _FriendsPageState extends State<FriendsPage> {
  10. static const List<Widget> _widgets = [
  11. FriendsList(),
  12. Requests(),
  13. ];
  14. @override
  15. Widget build(BuildContext context) {
  16. return DefaultTabController(
  17. length: 2,
  18. child: Scaffold(
  19. appBar: AppBar(
  20. automaticallyImplyLeading: false,
  21. bottom: TabBar(
  22. tabs: [
  23. Tab(
  24. child: Column(
  25. children: const [
  26. Icon(Icons.people),
  27. Text("Friends"),
  28. ],
  29. ),
  30. ),
  31. Tab(
  32. child: Column(
  33. children: const [
  34. Icon(Icons.notifications),
  35. Text("Requests"),
  36. ],
  37. ),
  38. ),
  39. ],
  40. ),
  41. ),
  42. body: const Center(
  43. child: Padding(
  44. padding: EdgeInsets.all(32.0),
  45. child: TabBarView(children: _widgets),
  46. ),
  47. ),
  48. ),
  49. );
  50. }
  51. }