import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'DialogRouter.dart';
import 'LoadingDialog.dart';
import 'MusicPlayer.dart';
import 'OneClick.dart';
class Login extends StatelessWidget {
const Login({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(home: LoginRoute());
}
}
class LoginRoute extends StatefulWidget {
const LoginRoute({Key? key}) : super(key: key);
@override
LoginRouteState createState() => LoginRouteState();
}
class LoginRouteState extends State<LoginRoute> {
@override
void initState() {
super.initState();
clearPrefs();
}
clearPrefs() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.clear();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/base_widgets/bg_sign_in.png"),
fit: BoxFit.cover,
),
),
child: Align(
alignment: FractionalOffset.bottomCenter,
child: GestureDetector(
onTap: () {
Navigator.push(context, DialogRouter(LoadingDialog(true)));
LoginNavigator();
},
child: Container(
decoration: const BoxDecoration(
color: Colors.pink,
borderRadius: BorderRadius.all(Radius.circular(50.0))),
margin: const EdgeInsets.only(bottom: 170),
height: 55,
width: 310,
padding:
const EdgeInsets.only(top: 17, left: 120, bottom: 17),
child: const Text(
'一键登录',
style: TextStyle(color: Colors.white, fontSize: 18),
),
))),
),
));
}
LoginNavigator() async {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => const MusicPlayer()),
(route) => route == null,
);
}
}
|