import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'Services/AuthServiec.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 dynamic user = _auth.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) { dynamic user2 = snapshot.data.docs[0]; // DatabaseManager manager = DatabaseManager(widget.name); Stream place = _auth.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["shared_id"]), ), 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'); }, ); } }