Fix SQL calls (android), library screen for narrow displays#202
Fix SQL calls (android), library screen for narrow displays#202Y-PLONI wants to merge 5 commits intomigrationDB_V2from
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request effectively addresses the stated goals of fixing SQL calls for PRAGMA statements on Android/iOS and improving the library screen's responsiveness for narrow displays. The changes to the SeforimRepository correctly differentiate between rawQuery and execute for PRAGMA statements on specific platforms, which is a good practice for database interactions. UI adjustments in CustomTitleBar and _MemorialCardsGrid enhance the user experience on smaller screens by optimizing button sizes, spacing, and grid layout. Additionally, the default value for libraryShowPreview has been consistently updated across the application's settings, state, and tests.
38ec1e3 to
c59e3e4
Compare
|
@gemini-code-assist |
There was a problem hiding this comment.
Code Review
This pull request introduces fixes for SQL calls on Android and improves the UI for narrow displays. The changes correctly handle PRAGMA statements on mobile platforms and add a fullscreen button for Android, which enhances usability on smaller screens. However, I've identified a couple of instances of code duplication that should be refactored to improve code maintainability. My detailed comments are below.
Note: Security Review did not run due to the size of the PR.
| IconButton( | ||
| icon: Icon( | ||
| settingsState.isFullscreen | ||
| ? FluentIcons.full_screen_minimize_24_regular | ||
| : FluentIcons.full_screen_maximize_24_regular, | ||
| size: 18, | ||
| ), | ||
| tooltip: settingsState.isFullscreen | ||
| ? 'צא ממסך מלא' | ||
| : 'מסך מלא', | ||
| onPressed: () async { | ||
| final newFullscreenState = !settingsState.isFullscreen; | ||
| await FullscreenHelper.toggleFullscreen( | ||
| context, | ||
| newFullscreenState, | ||
| ); | ||
| }, | ||
| style: _kIconButtonStyle.copyWith( | ||
| foregroundColor: WidgetStatePropertyAll( | ||
| Theme.of(context).colorScheme.onSurfaceVariant, | ||
| ), | ||
| ), | ||
| ), |
There was a problem hiding this comment.
This IconButton's implementation is a copy of the _buildAndroidFullscreenButton widget. Duplicating this logic can lead to maintenance issues if the button's behavior needs to be updated in the future. Please replace this with a call to the existing _buildAndroidFullscreenButton method to ensure code reusability.
| IconButton( | |
| icon: Icon( | |
| settingsState.isFullscreen | |
| ? FluentIcons.full_screen_minimize_24_regular | |
| : FluentIcons.full_screen_maximize_24_regular, | |
| size: 18, | |
| ), | |
| tooltip: settingsState.isFullscreen | |
| ? 'צא ממסך מלא' | |
| : 'מסך מלא', | |
| onPressed: () async { | |
| final newFullscreenState = !settingsState.isFullscreen; | |
| await FullscreenHelper.toggleFullscreen( | |
| context, | |
| newFullscreenState, | |
| ); | |
| }, | |
| style: _kIconButtonStyle.copyWith( | |
| foregroundColor: WidgetStatePropertyAll( | |
| Theme.of(context).colorScheme.onSurfaceVariant, | |
| ), | |
| ), | |
| ), | |
| _buildAndroidFullscreenButton(context, settingsState), |
| Future<void> executeRawQuery(String sql) async { | ||
| final db = await _database.database; | ||
| final normalizedSql = sql.trim().toUpperCase(); | ||
| final isPragma = normalizedSql.startsWith('PRAGMA '); | ||
|
|
||
| if (isPragma && (Platform.isAndroid || Platform.isIOS)) { | ||
| await db.rawQuery(sql); | ||
| return; | ||
| } | ||
|
|
||
| await db.execute(sql); | ||
| } |
1b8d25b to
9638a4f
Compare
ddaa291 to
b907b55
Compare
b907b55 to
c26aae8
Compare
No description provided.