timestamp_time_ago

Creator: coderz1093

Last updated:

0 purchases

timestamp_time_ago Image
timestamp_time_ago Images

Languages

Categories

Add to Cart

Description:

timestamp time ago

timestamp_time_ago #
Example #
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:timestamp_time_ago/timestamp_time_ago.dart';
import 'package:firebase_core/firebase_core.dart';

void main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Sohbet',
debugShowCheckedModeBanner: false,
theme: ThemeData(primarySwatch: Colors.cyan),
home: MyHomePage(),
);
}
}


class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection('hello').snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return new GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
childAspectRatio: (1 / 1), crossAxisCount: 2),
itemCount: snapshot.data.docs.length,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.all(5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
TimeStampTimeAgo(
timeStampData:
snapshot.data.docs[index].data()['activitytime'],
),
//↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
],
),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.cyan,
),
);
});
} else {
return Center(child: CircularProgressIndicator());
}
},
),
);
}
}

copied to clipboard

Use this Widget #
TimeStampTimeAgo(
timeStampData:
snapshot.data.docs[index].data()['activitytime'],
),
copied to clipboard
Output #

Others #
TimeStampTimeAgo(
timeStampData: snapshot.data.docs[index].data()['activitytime'],
yearAgo: 'yıl önce',
monthAgo: 'ay önce',
dayAgo: 'gün önce',
hourAgo: 'saat önce',
minuteAgo: 'dakika önce',
minuteLater: 'dakika sonra',
hourLater: 'saat sonra',
dayLater: 'gün sonra',
monthLater: 'ay sonra',
yearLater: 'yıl sonra',
textFontSize: 20,
textColor: Colors.purple,
textFontWeight: FontWeight.bold,
fontFamily: 'Klavika',
),
copied to clipboard
Output #

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.