Skip to content

Commit

Permalink
Merge pull request #25 from jesseframework/JF-192
Browse files Browse the repository at this point in the history
IB #JF-192 all fixed
  • Loading branch information
jesseframework authored Aug 8, 2020
2 parents 7bd72b3 + 1d3d508 commit dd6c8df
Show file tree
Hide file tree
Showing 16 changed files with 660 additions and 485 deletions.
File renamed without changes
12 changes: 7 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,13 @@ class _AppState extends State<App> {
@override
void didChangeDependencies() {
getIt<UserRepository>().getLocale().then((value) {
getIt<UserRepository>().getTheme().then((value1) {
setState(() {
_locale = value;
themeData = value1 == 'dark' ? darkTheme : lightTheme;
});
setState(() {
_locale = value;
});
});
getIt<UserRepository>().getTheme().then((value1) {
setState(() {
themeData = value1 == 'dark' ? darkTheme : lightTheme;
});
});
super.didChangeDependencies();
Expand Down
7 changes: 6 additions & 1 deletion lib/src/database/crud/user/user_crud.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class UserDao extends DatabaseAccessor<AppDatabase> with _$UserDaoMixin {
Future<User> getSingleUser(int id) {
return (select(db.users)..where((u) => u.id.equals(id))).getSingle();
}

Stream<User> watchSingleUser(int id) {
return (select(db.users)..where((u) => u.id.equals(id))).watchSingle();
}
Future<User> getSingleByName(int id) {
return (select(db.users)..where((u) => u.id.equals(id))).getSingle();
}
Expand All @@ -47,7 +49,10 @@ class UserDao extends DatabaseAccessor<AppDatabase> with _$UserDaoMixin {
(u) => u.userName.equals(userName) & u.tenantId.equals(tenantId)))
.getSingle();
}
Future updateSingleUser(User user) {
return (update(db.users).replace(user));

}
Future updateUser(UsersCompanion u, int id) {
return (update(db.users)..where((t) => t.id.equals(id))).write(
UsersCompanion(
Expand Down
64 changes: 55 additions & 9 deletions lib/src/database/moor_database.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/models/user_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Users extends Table implements MustHaveTenant {
DateTimeColumn get lastLoginTime => dateTime().nullable()();
IntColumn get tenantId => integer().nullable()();
TextColumn get currency => text().nullable()();
TextColumn get themeData => text().nullable()();

@override
Set<Column> get primaryKey => {id};
Expand Down
4 changes: 2 additions & 2 deletions lib/src/resources/repositories/user_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class UserRepository {
String tenantState = await _prefs.get('tenantState');
String userName = await _prefs.get('userName');
String tenantName = await _prefs.get('tenantName');
int tenantId = await _prefs.get('tenantId');
int userId = await _prefs.get('userId');
String tenantId = await _prefs.get('tenantId');
String userId = await _prefs.get('userId');

Map<String, String> map = {
"deviceId": "$deviceId",
Expand Down
2 changes: 1 addition & 1 deletion lib/src/resources/shared/utils/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ final lightTheme = ThemeData(
primaryColor: Colors.blue,
cardColor: Colors.white,
brightness: Brightness.light,
//backgroundColor: Color(0xffe7ebee),
backgroundColor: Color(0xffe7ebee),
scaffoldBackgroundColor:Color(0xffe7ebee) ,
accentColor: Colors.black87,
accentIconTheme: IconThemeData(color: Colors.white),
Expand Down
Loading

0 comments on commit dd6c8df

Please sign in to comment.