You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.8 KiB
Dart
61 lines
1.8 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class DrawerItem extends StatefulWidget {
|
|
final String title;
|
|
final String subTitle;
|
|
final IconData icon;
|
|
final Color color;
|
|
final dynamic assetLink;
|
|
|
|
const DrawerItem(this.title, {required this.icon, required this.color, this.subTitle = '', this.assetLink});
|
|
|
|
@override
|
|
_DrawerItemState createState() => _DrawerItemState();
|
|
}
|
|
|
|
class _DrawerItemState extends State<DrawerItem> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: EdgeInsets.only(top: 0, bottom: 5, left: 0, right: 0),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
if (widget.assetLink != null)
|
|
Container(
|
|
height: 20,
|
|
width: 20,
|
|
child: Image.asset(widget.assetLink),
|
|
),
|
|
if (widget.assetLink == null)
|
|
Icon(
|
|
widget.icon,
|
|
color: widget.color,
|
|
size: 25,
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.45,
|
|
child: Text(widget.title,
|
|
style: TextStyle(
|
|
color: widget.color ?? Color(0xFF2E303A),
|
|
fontSize: 14,
|
|
fontFamily: 'Poppins',
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: -0.84,
|
|
)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
));
|
|
}
|
|
}
|