friends_page.dart 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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: _widgets.length,
  18. child: Scaffold(
  19. appBar: AppBar(
  20. automaticallyImplyLeading: false,
  21. bottom: const TabBar(
  22. tabs: [
  23. Tab(child: Text("Friends", style: TextStyle(fontSize: 18))),
  24. Tab(child: Text("Requests", style: TextStyle(fontSize: 18))),
  25. ],
  26. ),
  27. ),
  28. body: const Center(
  29. child: Padding(
  30. padding: EdgeInsets.all(32.0),
  31. child: TabBarView(children: _widgets),
  32. ),
  33. ),
  34. ),
  35. );
  36. }
  37. }