-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Right-to-Left support to line painting (#31)
Author: https://github.com/naory159 * add rtl support * add direction to settings_view, fix rounded corners rtl issue
- Loading branch information
Showing
7 changed files
with
122 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
part of 'settings_view.dart'; | ||
|
||
class _DirectionSelector extends StatelessWidget { | ||
const _DirectionSelector({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final appController = AppController.of(context); | ||
|
||
return ValueListenableBuilder<TreeViewTheme>( | ||
valueListenable: appController.treeViewTheme, | ||
builder: (_, TreeViewTheme theme, __) { | ||
final selectedDirection = theme.direction; | ||
|
||
void changeDirection(TextDirection direction) { | ||
if (direction == selectedDirection) return; | ||
appController.updateTheme( | ||
theme.copyWith(direction: direction), | ||
); | ||
} | ||
|
||
return _SettingsButtonBar( | ||
label: 'Direction', | ||
buttonBarPadding: const EdgeInsets.symmetric(horizontal: 24), | ||
children: [ | ||
TextButton( | ||
onPressed: () => changeDirection(TextDirection.ltr), | ||
child: Text( | ||
'Left to Right', | ||
style: TextStyle( | ||
color: selectedDirection == TextDirection.ltr | ||
? kDarkBlue | ||
: Colors.grey, | ||
), | ||
), | ||
), | ||
TextButton( | ||
onPressed: () => changeDirection(TextDirection.rtl), | ||
child: Text( | ||
'Right to Left', | ||
style: TextStyle( | ||
color: selectedDirection == TextDirection.rtl | ||
? kDarkBlue | ||
: Colors.grey, | ||
), | ||
), | ||
), | ||
], | ||
); | ||
}, | ||
); | ||
} | ||
} |
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