/*
 * @author lsy
 * @date   2019-10-13
 **/

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:gmalpha_flutter/res/GMRes.dart';

AppBar baseAppBar(
    {String title,
    List<Widget> action,
    bool centerTitle,
    VoidCallback backClick}) {
  return AppBar(
    title: title == null ? Container() : baseText(title, 16, ALColors.Color323232),
    centerTitle: centerTitle,
    leading: GestureDetector(
      onTap: backClick,
      child: Container(
          alignment: Alignment.centerLeft,
          padding: EdgeInsets.only(left: 22),
          width: 30,
          height: double.maxFinite,
          child: SvgPicture.asset(
            "images/left_arrow.svg",
            color: Color(0xff323232),
          )),
    ),
    actions: action == null ? List<Widget>() : action,
  );
}

Text baseText(String text, double fontSize, Color color) {
  return Text(
    text,
    style: TextStyle(fontSize: fontSize, color: color),
  );
}

Widget baseDivide(double height, double padding, Color color) {
  return Container(
      height: height,
      margin: EdgeInsets.only(
          right: ScreenUtil.instance.setWidth(padding),
          left: ScreenUtil.instance.setWidth(padding)),
      child: Container(
        color: color,
      ));
}

Widget loadingItem() {
  //TODO
  return Center(child: CircularProgressIndicator());
}

Widget netErrorItem() {}

//TODO
