empty custom widget
custom_empty widget is flutter custom widget which is designed to notify user about some event.
screenshots | screenshots |
---|---|
1. add library to your pubspec.yaml
dependencies:
...
empty_widget: ^0.0.1-dev.1 # such as version, you need use the latest version of pub.
...
2. import library in dart file
import 'package:empty_widget.dart';
3. use of emptylistwidget
emptylistwidget(
title: 'no notification',
subtitle: 'no notification available yet',
image: 'assets/images/usericon.png',
titletextstyle: theme.of(context).typography.dense.display1.copywith(color: color(0xff9da9c7)),
subtitletextstyle: theme.of(context).typography.dense.body2.copywith(color: color(0xffabb8d6))
);
example
import 'package:empty_widget/empty_widget.dart';
import 'package:flutter/material.dart';
void main() => runapp(myapp());
class myapp extends statelesswidget {
@override
widget build(buildcontext context) {
return materialapp(
title: 'flutter demo',
theme: themedata(
primaryswatch: colors.blue,
),
home: myhomepage(title: 'empty widget demo'),
);
}
}
class myhomepage extends statefulwidget {
myhomepage({key key, this.title}) : super(key: key);
final string title;
@override
_myhomepagestate createstate() => _myhomepagestate();
}
class _myhomepagestate extends state<myhomepage> {
@override
widget build(buildcontext context) {
return scaffold(
appbar: appbar(
title: text(widget.title),
),
body: center(
child: container(
height: 500,
width:350,
child: emptylistwidget(
image : null,
packageimage: packageimage.image_1,
title: 'no notification',
subtitle: 'no notification available yet',
titletextstyle: theme.of(context).typography.dense.display1.copywith(color: color(0xff9da9c7)),
subtitletextstyle: theme.of(context).typography.dense.body2.copywith(color: color(0xffabb8d6))
),
)
),
);
}
}
parameters and value
images
image path can be assets image or null.
title
title can be string or null
subtitle
subtitle can be string or null
packageimage
available image assets in package type
: packageimage
values
- packageimage.image_1
- packageimage.image_2
- packageimage.image_3
- packageimage.image_4
titletextstyle
text style of title
subtitletextstyle
text style of subtitle
Comments are closed.