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
1f08d6f
commit b97ae88
Showing
38 changed files
with
180 additions
and
24 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+14.3 KB
(230%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-82 Bytes
(85%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-250 Bytes
(81%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-14 Bytes
(99%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-319 Bytes
(69%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-227 Bytes
(87%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+255 Bytes
(110%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-250 Bytes
(81%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+162 Bytes
(110%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+353 Bytes
(110%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+353 Bytes
(110%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+498 Bytes
(110%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+30 Bytes
(100%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+341 Bytes
(110%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
Oops, something went wrong.
Binary file modified
BIN
+349 Bytes
(110%)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
Oops, something went wrong.
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
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,73 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
import 'package:urban_dict_slang/providers/definitions_provider.dart'; | ||
import 'package:urban_dict_slang/providers/term_provider.dart'; | ||
import 'package:urban_dict_slang/providers/terms_provider.dart'; | ||
import 'package:urban_dict_slang/services/db/database.dart'; | ||
|
||
import 'package:urban_dict_slang/utils/styles.dart' as customStyles; | ||
|
||
class TermsListWithHeaders extends StatelessWidget { | ||
int getDaysDifference(DateTime viewed) => | ||
DateTime.now().difference(viewed).inDays; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
TermsProvider termsProvider = Provider.of<TermsProvider>(context); | ||
TermProvider termProvider = Provider.of<TermProvider>(context); | ||
DefinitionsProvider definitionsProvider = | ||
Provider.of<DefinitionsProvider>(context); | ||
List<int> _days = []; | ||
|
||
return ListView.builder( | ||
itemCount: termsProvider.terms.terms.length, | ||
itemBuilder: (BuildContext context, int index) { | ||
Term currentTerm = termsProvider.terms.terms[index]; | ||
int daysDifference = getDaysDifference(currentTerm.lastViewed); | ||
if (!_days.contains(daysDifference)) { | ||
_days.add(daysDifference); | ||
index -= 1; | ||
return Container( | ||
padding: EdgeInsets.all(10.0), | ||
decoration: BoxDecoration( | ||
color: customStyles.primaryColorLight, | ||
borderRadius: BorderRadius.only( | ||
topLeft: Radius.circular(10.0), | ||
topRight: Radius.circular(10.0), | ||
bottomLeft: Radius.circular(10.0), | ||
), | ||
), | ||
child: Text( | ||
daysDifference > 1 | ||
? '$daysDifference days ago' | ||
: daysDifference == 0 ? 'Today' : 'Yesterday', | ||
style: TextStyle(color: Colors.white, fontSize: 16.0), | ||
), | ||
); | ||
} else { | ||
return ListTile( | ||
onTap: () async { | ||
termProvider.updateTerm(currentTerm.term); | ||
definitionsProvider.updateDefinitions(currentTerm.term); | ||
var nav = await Navigator.of(context).pushNamed('/result'); | ||
if (nav == true || nav == null) { | ||
termsProvider.getTerms(); | ||
} | ||
}, | ||
title: Text( | ||
currentTerm.term[0].toUpperCase() + currentTerm.term.substring(1), | ||
style: customStyles.definitionTextStyle, | ||
), | ||
trailing: IconButton( | ||
icon: Icon(Icons.delete, color: Colors.red), | ||
onPressed: () { | ||
termsProvider.deleteTerm(currentTerm.term); | ||
termsProvider.getTerms(); | ||
}, | ||
), | ||
); | ||
} | ||
}, | ||
); | ||
} | ||
} |
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