| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- 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<CurrentUser> createState() => _CurrentUserState();
- }
- class _CurrentUserState extends State<CurrentUser> {
- final AuthenticationServices _auth = AuthenticationServices();
- late dynamic user = _auth.getCurrentUser();
- @override
- Widget build(BuildContext context) {
- return FutureBuilder<dynamic>(
- 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<int> 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');
- },
- );
- }
- }
|