Skip to content

Commit

Permalink
Added Nepali locale and updated example UI (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
nixrajput authored Jan 27, 2025
1 parent 8a547be commit c47fad4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [2.2.0]

- **Added:** Support for Nepali (ne) locale.
- **Updated:** Documentation for new locale.
- **Improved:** Updated and added new test cases.

## [2.1.2]

- **Updated:** Dependencies.
Expand Down
63 changes: 44 additions & 19 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,44 @@ class _GetTimeAgoExampleScreenState extends State<GetTimeAgoExampleScreen> {
),
child: Column(
children: [
DropdownButton<String>(
borderRadius: const BorderRadius.all(Radius.circular(16.0)),
isExpanded: true,
hint: const Text("Select Locale"),
value: _selectedLanguage,
onChanged: (String? newValue) {
setState(() {
_selectedLanguage = newValue;
});
},
items: languageNames.entries.map((entry) {
var code = entry.key;
var name = entry.value;
return DropdownMenuItem<String>(
value: code,
child: Text('$name ($code)'),
);
}).toList(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Select Locale: ',
style: TextStyle(fontSize: 16)),
Expanded(
child: DropdownButton<String>(
borderRadius:
const BorderRadius.all(Radius.circular(16.0)),
isExpanded: true,
isDense: true,
elevation: 0,
underline: Container(),
focusColor: Colors.transparent,
hint: const Text("Select Locale"),
value: _selectedLanguage,
onChanged: (String? newValue) {
setState(() {
_selectedLanguage = newValue;
});
},
items: languageNames.entries.map((entry) {
var code = entry.key;
var name = entry.value;
return DropdownMenuItem<String>(
value: code,
child: Text('$name ($code)',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
)),
);
}).toList(),
),
),
],
),
const Divider(),
Expanded(
child: ListView(
shrinkWrap: true,
Expand Down Expand Up @@ -204,7 +223,13 @@ class _GetTimeAgoExampleScreenState extends State<GetTimeAgoExampleScreen> {

Widget _buildExampleTile(BuildContext context, String title, String timeAgo) {
return ListTile(
title: Text(title),
title: Text(
title,
style: TextStyle(
color: Theme.of(context).hintColor,
fontSize: 16,
),
),
subtitle: Text(
timeAgo,
style: const TextStyle(
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: get_time_ago
description: A Dart package to convert and format `DateTime` objects into human-readable 'time ago' strings like '20 seconds ago', 'a minute ago', or '7 hours ago'.

version: 2.1.2
version: 2.2.0

homepage: https://pub.dev/packages/get_time_ago
repository: https://github.com/nixrajput/get_time_ago
Expand All @@ -26,4 +26,4 @@ topics:
funding:
- https://ko-fi.com/nixrajput
- https://buymeacoffee.com/nixrajput
- https://github.com/sponsors/nixrajput
- https://github.com/sponsors/nixrajput

0 comments on commit c47fad4

Please sign in to comment.