25 lines
		
	
	
		
			621 B
		
	
	
	
		
			Dart
		
	
	
		
		
			
		
	
	
			25 lines
		
	
	
		
			621 B
		
	
	
	
		
			Dart
		
	
	
|  | import 'dart:ffi'; | |||
|  | 
 | |||
|  | import 'package:flutter/material.dart'; | |||
|  | 
 | |||
|  | import 'h_colors.dart'; | |||
|  | /// 标签(eg:风险等级)
 | |||
|  | Widget riskTagText(int level, String title) { | |||
|  | 
 | |||
|  |   final List<Color> colors = riskLevelTextColors(); | |||
|  |   if (colors.length <= (level - 1)) { | |||
|  |     return SizedBox(); | |||
|  |   } | |||
|  |   return Container( | |||
|  |     padding: EdgeInsets.symmetric(vertical: 3, horizontal: 5), | |||
|  |     decoration: BoxDecoration( | |||
|  |       color: colors[level-1], | |||
|  |       borderRadius: const BorderRadius.all(Radius.circular(5)), | |||
|  |     ), | |||
|  |     // color: Colors.,
 | |||
|  |     child: Text( | |||
|  |       title, | |||
|  |       style: TextStyle(color: Colors.white, fontSize: 14), | |||
|  |     ), | |||
|  |   ); | |||
|  | } |