|
- import 'package:flutter/material.dart';
- import 'package:zhiying_comm/zhiying_comm.dart';
-
- class HomeAuth extends StatelessWidget {
- final Map<String, dynamic> data;
-
- const HomeAuth(this.data, {Key key}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- return Container(
- height: 34,
- width: double.infinity,
- margin: EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 4),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(17),
- boxShadow: [
- BoxShadow(
- offset: Offset(2, 1), //x,y轴
- color: Color(0x4d767676), //投影颜色
- blurRadius: 5 //投影距离
- )
- ]),
- child: Row(
- children: <Widget>[
- Container(
- margin: EdgeInsets.only(left: 10, right: 8),
- width: 20,
- height: 20,
- color: Colors.redAccent,
- ),
- Expanded(
- child: Text(
- '一键授权淘宝权限,让购物更轻松',
- maxLines: 1,
- style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
- ),
- ),
- GestureDetector(
- child: Container(
- padding: EdgeInsets.only(left: 12, right: 12, top: 3, bottom: 3),
- margin: EdgeInsets.only(left: 8, right: 8),
- decoration: BoxDecoration(
- color: Colors.redAccent,
- borderRadius: BorderRadius.circular(20)),
- child: Text(
- '点击授权',
- style: TextStyle(fontSize: 12, color: Colors.white),
- ),
- ),
- onTap: () async {
- bool isAuth = await TaobaoAuth.isAuth();
- if (!isAuth) {
- TaobaoAuth.auth(context);
- } else {
- Logger.debug('您已经授权过了');
- }
- },
- ),
- ],
- ),
- );
- }
- }
|