Comments (17)
@LebenNNA I will solve it in the next version (0.1.9).
from flutter_tags.
@LebenNNA it's a problem I've encountered since the beginning, but I think I've found the solution...
Wait for the next version
from flutter_tags.
@LebenNNA what content do you refer to, text or tag? please post your code here.
from flutter_tags.
These are my parameters
final List<String> _list = [
'网易云',
'拼多多',
'美术',
'互联网',
'炫舞时代',
'猫耳FM',
'爱奇艺',
'网易大神',
'美容',
'小红书',
'同人文',
'食物语',
'篝火营地',
'哔了狗了QP又不够了。。',
'草丛三剑客',
'Whose you daddy',
'Black sheep wall',
'上上下下左右左右ABBA',
];
bool _symmetry = false;
bool _singleItem = false;
int _column = 10;
double _fontSize = 14.0;
Color _textColor = Color(0xff252c41);
Color _selActiveColor = Color(0xfff75262);
Color _allActiveColor = Color(0x80f75262);
EdgeInsets _margin =
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 12.5);
String _selectableOnPressed = '';
List<Tag> _selectableTags = [];
List<Tag> _selectedTags = [];
int index = 0;
_list.forEach(
(item) {
_selectableTags.add(
Tag(
id: index,
title: item,
active: false,
),
);
index++;
},
);
SelectableTags(
tags: _selectableTags,
columns: _column,
// textColor: _textColor,
fontSize: _fontSize,
symmetry: _symmetry,
singleItem: _singleItem,
activeColor: _allActiveColor,
margin: _margin,
boxShadow: [],
onPressed: (tag) {
setState(() {
_selectableOnPressed = tag.toString();
print('--------selectableOnPressed:$_selectableOnPressed--------');
_selectableTags.remove(tag);
_selectedTags.add(tag);
});
},
);
I use the SelectableTags..
I have another problem. When the title is short enough, I find that each tag has a minimum width, not calculated based on the byte length of the title.
@Dn-a
from flutter_tags.
Ok, I am looking forward to it.
from flutter_tags.
I have another problem. When the title is short enough, I find that each tag has a minimum width, not calculated based on the byte length of the title.
And Can this problem be solved?
@Dn-a
from flutter_tags.
@LebenNNA install version 0.2.0, take a test and let me know
from flutter_tags.
These are my code
import 'package:flutter/material.dart';
import 'package:x5_shequ_main/widgets/select_topic/SelectableTag.dart';
class SelectTopicPage extends StatefulWidget {
@override
_SelectTopicPageState createState() => _SelectTopicPageState();
}
class _SelectTopicPageState extends State<SelectTopicPage>
with SingleTickerProviderStateMixin {
Animation<double> tween;
AnimationController controller;
static const int milliseconds = 2000;
final List<String> _list = [
'网易云',
'拼多多',
'美术',
'互联网',
'炫舞时代',
'猫耳FM',
'爱奇艺',
'网易大神',
'美容',
'小红书',
'同人文',
'食物语',
'篝火营地',
'哔了狗了QP又不够了。。',
'草丛三剑客',
'Whose you daddy',
'Black sheep wall',
'上上下下左右左右ABBA',
];
bool _symmetry = false;
bool _singleItem = false;
int _column = 10;
double _fontSize = 14.0;
Color _textColor = Color(0xff252c41);
Color _selActiveColor = Color(0xfff75262);
Color _allActiveColor = Color(0x80f75262);
EdgeInsets _margin =
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 12.5);
String _selectableOnPressed = '';
List<Tag> _selectableTags = [];
List<Tag> _selectedTags = [];
@override
void initState() {
super.initState();
//创建动画控制类对象
controller = AnimationController(
duration: const Duration(milliseconds: milliseconds), vsync: this);
//创建补间对象
tween = Tween(begin: 0.0, end: 1.0).animate(controller) // 返回Animation对象
..addListener(() {
// 添加监听
setState(() {
print(tween.value); // 打印补间插值
});
});
controller.forward(); // 执行动画
int index = 0;
_list.forEach(
(item) {
_selectableTags.add(
Tag(
id: index,
title: item,
active: false,
),
);
index++;
},
);
}
Widget _selectedTopicBuilder() {
return SelectableTags(
tags: _selectedTags,
columns: _column,
offset: 28,
textColor: _textColor,
fontSize: _fontSize,
symmetry: _symmetry,
singleItem: _singleItem,
activeColor: _selActiveColor,
margin: _margin,
boxShadow: [],
onPressed: (tag) {
_selectableOnPressed = tag.toString();
print('--------selectableOnPressed:$_selectableOnPressed--------');
setState(() {
_selectedTags.remove(tag);
_selectableTags.add(tag);
Tag.selectSort(_selectableTags);
});
},
);
}
Widget _allTopicBuilder() {
return SelectableTags(
tags: _selectableTags,
columns: _column,
offset: 28,
// textColor: _textColor,
fontSize: _fontSize,
symmetry: _symmetry,
singleItem: _singleItem,
activeColor: _allActiveColor,
margin: _margin,
boxShadow: [],
onPressed: (tag) {
setState(() {
_selectableOnPressed = tag.toString();
print('--------selectableOnPressed:$_selectableOnPressed--------');
_selectableTags.remove(tag);
_selectedTags.add(tag);
});
},
);
}
Widget _selectTopicBuilder() {
return ListView(
children: <Widget>[
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(vertical: 42.5),
),
// 已选部分
Container(
color: Colors.white,
child: _selectedTags.length == 0
? Text(
'关注一些感兴趣的话题',
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
)
: _selectedTopicBuilder(),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 30.0),
),
// 未选部分
Container(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
from flutter_tags.
Sometimes there will be cases where the content is not fully displayed. . @Dn-a
This is zhe cut image of iphone8plus emulator
from flutter_tags.
How can I set the tag to set its own length based on the length of the title?
from flutter_tags.
from flutter_tags.
I guess the result is caused by the outlinebutton
from flutter_tags.
@LebenNNA
important update in the version 0.2.1
try it and let me know
from flutter_tags.
I still have a question, how to set the control fixed height vertically scrollable, or set only one line, then you can scroll horizontally @Dn-a
from flutter_tags.
In the ListView
you can set scrollDirection: Axis.horizontal
or scrollDirection: Axis.vertical
example:
return ListView.separated(
scrollDirection: Axis.horizontal,
separatorBuilder: (context, index) => Divider(height: 50),
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
....
return <create List item>
});
from flutter_tags.
@LebenNNA can i close the problem?
from flutter_tags.
ok, thank you
from flutter_tags.
Related Issues (20)
- Can I set a different color for each tag?
- Preserve the scroll position between tabs (so, after a widget rebuid) HOT 4
- Allow deselection of a tag when singleItem is true HOT 2
- Programatically select a tag during build and trigger onPressed event HOT 7
- Add possibility to pass textController HOT 2
- Custom Validation while inserting Tags
- Override default onPressed callback
- Keep focus after submit HOT 3
- type 'Null' is not a subtype of type 'DataList' in type cast HOT 15
- Several Issues, and feature request HOT 3
- Tags' is defined in the libraries 'package:flutter_tags/src/tags.dart
- Add support for null-safety HOT 2
- There is no way to change the tag inActive color HOT 1
- No automatic scrolling into the right after adding a new tag
- Too many errors in the new null safety version, corrected some but please correct all and republish HOT 2
- Null safe Alternative HOT 1
- expose textfield controller
- Upgrade to Flutter 3 HOT 1
- Is it possible to customize close button place?
- Is this package deprecated? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_tags.