Skip to content

Commit

Permalink
newFeature: 1.添加描边字的源码
Browse files Browse the repository at this point in the history
  • Loading branch information
liumin committed Jan 19, 2021
1 parent 589e009 commit 3840ee6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ doc/api/
*.js_
*.js.deps
*.js.map

.idea
35 changes: 35 additions & 0 deletions main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';

class StrokeFont {
///
/// 生成描边字
/// fontStr 内容
/// fontSize 字体大小
/// strokeColor 描边色
/// strokeWidth 描边宽度
/// fillColor 填充色
Widget renderFont (String fontStr, double fontSize, { Color strokeColor: Colors.black,double strokeWidth: 2.0, Color fillColor: Colors.white, }) {
return Stack(
children: [
Text(
fontStr,
style: TextStyle(
fontSize: fontSize,
fontWeight: FontWeight.bold,
foreground: Paint()..strokeWidth = strokeWidth..color = strokeColor..style = PaintingStyle.stroke,
decoration: TextDecoration.none
),
),
Text(
fontStr,
style: TextStyle(
fontSize: fontSize,
fontWeight: FontWeight.bold,
foreground: Paint()..strokeWidth = strokeWidth..color = fillColor..style = PaintingStyle.fill,
decoration: TextDecoration.none
)
),
],
);
}
}

0 comments on commit 3840ee6

Please sign in to comment.