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