Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ProfilePage extends ConsumerStatefulWidget {
- final String? userId;
- const ProfilePage({super.key, this.userId});
- @override
- ConsumerState<ProfilePage> createState() => _ProfilePageState();
- }
- class _ProfilePageState extends ConsumerState<ProfilePage>
- with SingleTickerProviderStateMixin {
- late final TabController _tabController;
- @override
- void initState() {
- super.initState();
- _tabController = TabController(length: 3, vsync: this);
- }
- @override
- void dispose() {
- _tabController.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- final colorScheme = Theme.of(context).colorScheme;
- final currentUserId = AuthRepository().currentUser?.id;
- final targetUserId = widget.userId ?? currentUserId;
- final isCurrentUser = targetUserId == currentUserId;
- final profile = ref.watch(cachedProfileProvider);
- return Scaffold(
- backgroundColor: colorScheme.surface,
- body: NestedScrollView(
- headerSliverBuilder: (context, innerBoxScrolled) {
- return [
- _ProfileAppBar(),
- SliverPadding(
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
- sliver: SliverToBoxAdapter(
- child: _ProfileHeader(),
- ),
- ),
- SliverPersistentHeader(
- pinned: true,
- delegate: _SliverAppBarDelegate(
- TabBar(
- controller: _tabController,
- tabs: const [
- Tab(text: 'Profile'),
- Tab(text: 'Private'),
- Tab(text: 'Settings'),
- ],
- ),
- ),
- ),
- ];
- },
- body: TabBarView(
- controller: _tabController,
- children: [
- TabViewTab(
- children: [
- _ProfileBio(),
- ActivityCard(),
- DietaryInfoCard(),
- ],
- ),
- TabViewTab(
- children: [PrivateInfoCard()],
- ),
- TabViewTab(
- children: [Text('Settings')],
- ),
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement