-
Notifications
You must be signed in to change notification settings - Fork 15
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
Showing
14 changed files
with
277 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5f846f478592c21f0cf999f1253bb25f |
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
File renamed without changes.
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,56 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:mongol/mongol.dart'; | ||
|
||
/// This demo shows that MongolText can be resized with pinch to zoom. | ||
class GestureDetectorDemo extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Center( | ||
child: Container( | ||
color: Colors.blue[100], | ||
child: SafeArea(child: GestureText()), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class GestureText extends StatefulWidget { | ||
const GestureText({ | ||
Key key, | ||
this.child, | ||
}) : super(key: key); | ||
|
||
final Widget child; | ||
|
||
@override | ||
_GestureTextState createState() => _GestureTextState(); | ||
} | ||
|
||
class _GestureTextState extends State<GestureText> { | ||
double _fontSize = 100; | ||
final double _baseFontSize = 20; | ||
double _fontScale = 1; | ||
double _baseFontScale = 1; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onScaleStart: (ScaleStartDetails scaleStartDetails) { | ||
_baseFontScale = _fontScale; | ||
}, | ||
onScaleUpdate: (ScaleUpdateDetails scaleUpdateDetails) { | ||
setState(() { | ||
_fontScale = | ||
(_baseFontScale * scaleUpdateDetails.scale).clamp(0.5, 10.0); | ||
_fontSize = _fontScale * _baseFontSize; | ||
}); | ||
}, | ||
child: MongolText( | ||
'ᠮᠣᠩᠭᠣᠯ\nᠪᠢᠴᠢᠭ', | ||
style: TextStyle(fontSize: _fontSize), | ||
), | ||
); | ||
} | ||
} |
File renamed without changes.
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
Oops, something went wrong.