-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca540fd
commit 7326bbb
Showing
67 changed files
with
1,537 additions
and
778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:intl/intl.dart'; | ||
import 'package:khelo/domain/extensions/context_extensions.dart'; | ||
|
||
enum DateFormatType { dateAndTime, } | ||
|
||
extension DateFormatter on DateTime { | ||
String format(BuildContext context, DateFormatType type) { | ||
if (isUtc) return toLocal().format(context, type); | ||
|
||
switch (type) { | ||
case DateFormatType.dateAndTime: | ||
return DateFormat( | ||
'EEE, MMM dd yyyy ${context.is24HourFormat ? 'HH:mm' : 'hh:mm a'}') | ||
.format(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:khelo/domain/extensions/context_extensions.dart'; | ||
|
||
const _missing = '-'; | ||
|
||
extension StringExtension on String? { | ||
String format(BuildContext context, StringFormats formatType) { | ||
if (this == null) return _missing; | ||
|
||
switch (formatType) { | ||
case StringFormats.obscurePhoneNumber: | ||
if (this!.length < 13) { | ||
return _missing; | ||
} | ||
return context.l10n.common_obscure_phone_number_text( | ||
this!.substring(0, 3), | ||
this!.substring(this!.length - 2)); // TODO: change to 1 if needed | ||
} | ||
} | ||
} | ||
|
||
enum StringFormats { | ||
obscurePhoneNumber('+## ***** ***##'); | ||
|
||
const StringFormats(this.value); | ||
|
||
final String value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,4 +79,4 @@ class _AppState extends ConsumerState<App> { | |
}, | ||
)); | ||
} | ||
} | ||
} |
Oops, something went wrong.