import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:physigo/Services/logged_in_user.dart'; import 'Services/AuthService.dart'; class CurrentUser extends StatefulWidget { const CurrentUser({required this.name, Key? key}) : super(key: key); final String name; @override State createState() => _CurrentUserState(); } class _CurrentUserState extends State { final AuthenticationServices _auth = AuthenticationServices(); late Future user = AuthenticationServices.getCurrentUser(); @override Widget build(BuildContext context) { return FutureBuilder( future: user, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const Text('Wait a moment'); } else if (snapshot.connectionState == ConnectionState.done) { LoggedInUser user2 = snapshot.data!; // DatabaseManager manager = DatabaseManager(widget.name); Stream place = AuthenticationServices.getPlace(user2); return Row( children: [ SizedBox( height: 100, width: 55, ), SizedBox( height: 100, width: 50, child: StreamBuilder( stream: place, builder: (context, snapshot) { return Text("${snapshot.data}"); }, ), ), SizedBox( height: 100, width: 135, child: Text(user2.sharedId), ), SizedBox( height: 100, width: 60, child: Text(user2.name), ), // SizedBox( // height: 100, // width: 50, // child: Text("${user2[widget.name]}"), // ), ], ); } return const Text('Something went wrong'); }, ); } }