datalandingpage_devaloop_com 0.1.0
SDKflutter
Platformandroidioswindowslinuxmacosweb
datalandingpage_devaloop_com package project.
DataLandingPage is widget for simple landing page data.
Home Page
https://github.com/devaloop/datalandingpage_devaloop_com
Home Page
Widget DataLandingPage Contain Templates:
- Total data
- Top 10 Latest Data
- Action for Add Data
- Action for Search Data
Demo Usage
https://datalandingpage.devaloop.com/
Usage
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:intl/intl.dart';
import 'package:datalandingpage_devaloop_com/data_landing_page.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Data Landing Page Example',
debugShowCheckedModeBanner: false,
theme: themeData,
home: const DataLandingPageExample(),
);
}
}
class DataLandingPageExample extends StatefulWidget {
const DataLandingPageExample({super.key});
@override
State<DataLandingPageExample> createState() => _DataLandingPageExampleState();
}
class _DataLandingPageExampleState extends State<DataLandingPageExample> {
@override
Widget build(BuildContext context) {
return DataLandingPage(
dataTitle: "People",
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
const DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text('Drawer Header'),
),
ListTile(
title: const Text('Item 1'),
onTap: () {
},
),
ListTile(
title: const Text('Item 2'),
onTap: () {
},
),
],
),
),
addClick: () {},
searchClick: () {},
refreshClick: () {
setState(() {});
},
showLatest: Future(() async {
await Future.delayed(const Duration(seconds: 2));
var data = peopleDummy
.map(
(p) => ListTile(
key: Key(p.id),
title: Text(p.name),
subtitle: Column(
children: [
Align(
alignment: Alignment.topLeft,
child: Text(
'Company: ${p.company} Registered: ${DateFormat('yyyy-MM-dd').format(p.registered)}'),
),
Align(
alignment: Alignment.topRight,
child: Text(p.addOrUpdate),
),
Align(
alignment: Alignment.topRight,
child: Text(DateFormat('yyyy-MM-dd hh:mm:ss')
.format(p.lastUpdate)),
),
Align(
alignment: Alignment.topRight,
child: Text(p.userUpdate),
),
],
),
onTap: () {},
),
)
.toList();
return data;
}),
totalData: Future(() async {
await Future.delayed(const Duration(seconds: 3));
return 256;
}),
addedToday: Future(() async {
await Future.delayed(const Duration(seconds: 2));
return 15;
}),
updatedToday: Future(() async {
await Future.delayed(const Duration(seconds: 1));
return 8;
}),
);
}
}
class People {
final String id;
final String name;
final String company;
final DateTime registered;
final String addOrUpdate;
final DateTime lastUpdate;
final String userUpdate;
People({
required this.id,
required this.name,
required this.company,
required this.registered,
required this.addOrUpdate,
required this.lastUpdate,
required this.userUpdate,
});
}
List<People> peopleDummy = [
People(
id: '1',
name: 'Douglas Myers',
company: 'Myers Health Products Ltd',
registered: DateTime.parse('2023-01-01'),
addOrUpdate: 'Added',
lastUpdate: DateTime.parse('2023-06-02 12:00:00'),
userUpdate: 'admin@devaloop.com'),
People(
id: '2',
name: 'Stacy Sampson',
company: 'Sampson Care Services Ltd',
registered: DateTime.parse('2023-01-02'),
addOrUpdate: 'Updated',
lastUpdate: DateTime.parse('2023-06-02 12:00:01'),
userUpdate: 'zack@devaloop.com'),
People(
id: '3',
name: 'Larry Newbold',
company: 'Newbold Aviation Ltd',
registered: DateTime.parse('2023-01-03'),
addOrUpdate: 'Added',
lastUpdate: DateTime.parse('2023-06-02 12:00:02'),
userUpdate: 'willi@devaloop.com'),
People(
id: '4',
name: 'Sarah Jordan',
company: 'Jordan Camping Supplies Ltd',
registered: DateTime.parse('2023-01-04'),
addOrUpdate: 'Updated',
lastUpdate: DateTime.parse('2023-06-02 12:00:03'),
userUpdate: 'admin@devaloop.com'),
People(
id: '5',
name: 'Zak Xavier',
company: 'Xavier Sprayers Ltd',
registered: DateTime.parse('2023-01-05'),
addOrUpdate: 'Added',
lastUpdate: DateTime.parse('2023-06-02 12:00:04'),
userUpdate: 'zack@devaloop.com'),
People(
id: '6',
name: 'Shirley Fletcher',
company: 'Fletcher Furnishings Ltd',
registered: DateTime.parse('2023-01-06'),
addOrUpdate: 'Updated',
lastUpdate: DateTime.parse('2023-06-02 12:00:05'),
userUpdate: 'willi@devaloop.com'),
People(
id: '7',
name: 'Paul Laker',
company: 'Laker Machinery Ltd',
registered: DateTime.parse('2023-01-07'),
addOrUpdate: 'Added',
lastUpdate: DateTime.parse('2023-06-02 12:00:06'),
userUpdate: 'admin@devaloop.com'),
People(
id: '8',
name: 'Kimberley Kilbane',
company: 'South View Party Supplies Ltd',
registered: DateTime.parse('2023-01-08'),
addOrUpdate: 'Updated',
lastUpdate: DateTime.parse('2023-06-02 12:00:07'),
userUpdate: 'zack@devaloop.com'),
People(
id: '9',
name: 'Andrew Adams',
company: 'Adams Gardening Services Ltd',
registered: DateTime.parse('2023-01-09'),
addOrUpdate: 'Added',
lastUpdate: DateTime.parse('2023-06-02 12:00:08'),
userUpdate: 'willi@devaloop.com'),
People(
id: '10',
name: 'Abby Elsworth',
company: 'North Point Removals Ltd',
registered: DateTime.parse('2023-01-10'),
addOrUpdate: 'Updated',
lastUpdate: DateTime.parse('2023-06-02 12:00:09'),
userUpdate: 'admin@devaloop.com'),
];
var themeData = ThemeData(
colorScheme: const ColorScheme(
brightness: Brightness.light,
primary: Colors.blue,
onPrimary: Colors.white,
secondary: Colors.blue, //
onSecondary: Colors.white, //
error: Colors.red,
onError: Colors.red,
background: Colors.white, //
onBackground: Colors.white, //
surface: Colors.white,
onSurface: Colors.black87,
),
//scaffoldBackgroundColor: Colors.blue, //backgroud selain app bar
//primarySwatch: Colors.blue,
appBarTheme: const AppBarTheme(
color: Colors.transparent,
//backgroundColor: Colors.white70, //backgroud app bar
foregroundColor: Colors.black87,
elevation: 0,
systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.dark, // For Android (dark icons)
statusBarBrightness: Brightness.light, // For iOS (dark icons)
),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
shape: MaterialStateProperty.resolveWith<OutlinedBorder>((_) {
return RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
);
}),
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(states) => Colors.white,
),
elevation: MaterialStateProperty.resolveWith(
(states) => 0,
),
overlayColor: MaterialStateProperty.resolveWith(
(states) => Colors.grey,
),
fixedSize: MaterialStateProperty.resolveWith(
(states) => const Size(100, 40),
),
alignment: Alignment.center,
side: MaterialStateProperty.resolveWith<BorderSide>(
(states) => const BorderSide(
color: Colors.grey,
style: BorderStyle.solid,
),
),
foregroundColor: MaterialStateProperty.resolveWith<Color>(
(states) => Colors.black87,
),
textStyle: MaterialStateProperty.resolveWith<TextStyle>(
(states) => const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
),
),
);