loc-chain-app/loc_chain_app/lib/main.dart

28 lines
721 B
Dart
Raw Normal View History

2021-04-10 02:35:30 +00:00
import 'package:flutter/material.dart';
2021-04-10 18:45:44 +00:00
import 'package:shared_preferences/shared_preferences.dart';
2021-04-10 15:26:20 +00:00
import 'package:loc_chain_app/widgets/navbar.dart';
2021-04-10 19:01:03 +00:00
import 'dart:math';
2021-04-10 02:35:30 +00:00
2021-04-10 18:45:44 +00:00
void main() async {
2021-04-10 19:06:54 +00:00
runApp(App());
2021-04-10 18:45:44 +00:00
final prefs = await SharedPreferences.getInstance();
2021-04-10 20:19:32 +00:00
final userName = prefs.getString('userName') ?? '0';
2021-04-10 20:36:05 +00:00
if (userName == '0') {
2021-04-10 19:01:03 +00:00
prefs.setString('id', Random().nextInt(10000).toString());
}
2021-04-10 02:35:30 +00:00
}
2021-04-10 15:26:20 +00:00
class App extends StatelessWidget {
2021-04-10 02:35:30 +00:00
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
2021-04-10 15:26:20 +00:00
primarySwatch: Colors.lightBlue,
2021-04-10 02:35:30 +00:00
),
2021-04-10 15:26:20 +00:00
home: NavBarWidget(),
2021-04-10 02:35:30 +00:00
);
}
}