Giter Site home page Giter Site logo

generate_style's Introduction

generate_style

生成Flutter项目模板样式代码

最终生成的代码

class MyTextStyle {
  static final color333333_font10 = TextStyle(color: Color(0xFF333333), fontSize: 10);

  static final color333333_font11 = TextStyle(color: Color(0xFF333333), fontSize: 11);

  static final color333333_font12 = TextStyle(color: Color(0xFF333333), fontSize: 12);
  
  // ....
}


class MyBoxDecoration {
  static final colorFFFFFF_borderRadius3 = BoxDecoration(color: Color(0xFFFFFFFF), borderRadius: BorderRadius.circular(3));

  static final colorFFFFFF_borderRadius4 = BoxDecoration(color: Color(0xFFFFFFFF), borderRadius: BorderRadius.circular(4));

  static final colorFFFFFF_borderRadius5 = BoxDecoration(color: Color(0xFFFFFFFF), borderRadius: BorderRadius.circular(7));
  
  // ...
}

用法

  1. 在项目根目录生成 env.py
# 生成的样式文件存放路径
generate_file_dir = 'xxx/generated/'

# 生成的文本样式
text_style_file = "my_text_style.dart"
text_color_arr = [
    "333333",
]
text_font_arr = [
    "10",
    "11",
    "12"
]
text_weight_arr = [
    "500"
]

# 生成盒子样式
box_decoration_file = "my_box_decoration.dart"
box_decoration_color_arr = [
    "FFFFFF"
]
box_decoration_border_radius_arr = [
    "3",
    "4",
    "5"
]
  1. 运行main.py

generate_style's People

Contributors

wangyng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.