当前位置: 首页 > news >正文

Flutter 解决ExpansionTile上下分割线问题,以及title撑满问题


文章目录

  • 前言
  • 一、解决上下分割线问题
  • 二、使ExpansionTile的title撑满
  • 总结


前言

最近在做flutter项目,其中的一个功能用到了ExpansionTile的效果,奈何我们的设计师要求很高,展开的时候不能有上下一根线,而且我们是不需要展开的按钮,也就是说,让title横向撑满显示组件的信息。


一、解决上下分割线问题

1、使用Theme,然后把dividerColor的颜色改为透明或者白色,就能解决问题。

 Theme(data: Theme.of(context).copyWith(dividerColor: Colors.transparent),child: BSExpansionTile(trailing: null,title: _buildTitle(model),onExpansionChanged: (value) {setState(() {isExpanded = value;});},initiallyExpanded: isExpanded,children: _buildWalletItemList(),),);

二、使ExpansionTile的title撑满

1、查看它的源码发现都会有一个默认展开的箭头问题,只能把它的源码拷贝出来重新写了,把名字改为:BSExpansionTile

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.import 'package:flutter/material.dart';const Duration _kExpand = Duration(milliseconds: 200);/// Enables control over a single [ExpansionTile]'s expanded/collapsed state.
///
/// It can be useful to expand or collapse an [ExpansionTile]
/// programatically, for example to reconfigure an existing expansion
/// tile based on a system event. To do so, create an [ExpansionTile]
/// with an [ExpansionTileController] that's owned by a stateful widget
/// or look up the tile's automatically created [ExpansionTileController]
/// with [ExpansionTileController.of]
///
/// The controller's [expand] and [collapse] methods cause the
/// the [ExpansionTile] to rebuild, so they may not be called from
/// a build method.
class ExpansionTileController {/// Create a controller to be used with [ExpansionTile.controller].ExpansionTileController();_BSExpansionTileState? _state;/// Whether the [ExpansionTile] built with this controller is in expanded state.////// This property doesn't take the animation into account. It reports `true`/// even if the expansion animation is not completed.////// See also://////  * [expand], which expands the [ExpansionTile].///  * [collapse], which collapses the [ExpansionTile].///  * [ExpansionTile.controller] to create an ExpansionTile with a controller.bool get isExpanded {assert(_state != null);return _state!._isExpanded;}/// Expands the [ExpansionTile] that was built with this controller;////// Normally the tile is expanded automatically when the user taps on the header./// It is sometimes useful to trigger the expansion programmatically due/// to external changes.////// If the tile is already in the expanded state (see [isExpanded]), calling/// this method has no effect.////// Calling this method may cause the [ExpansionTile] to rebuild, so it may/// not be called from a build method.////// Calling this method will trigger an [ExpansionTile.onExpansionChanged] callback.////// See also://////  * [collapse], which collapses the tile.///  * [isExpanded] to check whether the tile is expanded.///  * [ExpansionTile.controller] to create an ExpansionTile with a controller.void expand() {assert(_state != null);if (!isExpanded) {_state!._toggleExpansion();}}/// Collapses the [ExpansionTile] that was built with this controller.////// Normally the tile is collapsed automatically when the user taps on the header./// It can be useful sometimes to trigger the collapse programmatically due/// to some external changes.////// If the tile is already in the collapsed state (see [isExpanded]), calling/// this method has no effect.////// Calling this method may cause the [ExpansionTile] to rebuild, so it may/// not be called from a build method.////// Calling this method will trigger an [ExpansionTile.onExpansionChanged] callback.////// See also://////  * [expand], which expands the tile.///  * [isExpanded] to check whether the tile is expanded.///  * [ExpansionTile.controller] to create an ExpansionTile with a controller.void collapse() {assert(_state != null);if (isExpanded) {_state!._toggleExpansion();}}/// Finds the [ExpansionTileController] for the closest [ExpansionTile] instance/// that encloses the given context.////// If no [ExpansionTile] encloses the given context, calling this/// method will cause an assert in debug mode, and throw an/// exception in release mode.////// To return null if there is no [ExpansionTile] use [maybeOf] instead.////// {@tool dartpad}/// Typical usage of the [ExpansionTileController.of] function is to call it from within the/// `build` method of a descendant of an [ExpansionTile].////// When the [ExpansionTile] is actually created in the same `build`/// function as the callback that refers to the controller, then the/// `context` argument to the `build` function can't be used to find/// the [ExpansionTileController] (since it's "above" the widget/// being returned in the widget tree). In cases like that you can/// add a [Builder] widget, which provides a new scope with a/// [BuildContext] that is "under" the [ExpansionTile]:////// ** See code in examples/api/lib/material/expansion_tile/expansion_tile.1.dart **/// {@end-tool}////// A more efficient solution is to split your build function into/// several widgets. This introduces a new context from which you/// can obtain the [ExpansionTileController]. With this approach you/// would have an outer widget that creates the [ExpansionTile]/// populated by instances of your new inner widgets, and then in/// these inner widgets you would use [ExpansionTileController.of].static ExpansionTileController of(BuildContext context) {final _BSExpansionTileState? result = context.findAncestorStateOfType<_BSExpansionTileState>();if (result != null) {return result._tileController;}throw FlutterError.fromParts(<DiagnosticsNode>[ErrorSummary('ExpansionTileController.of() called with a context that does not contain a ExpansionTile.',),ErrorDescription('No ExpansionTile ancestor could be found starting from the context that was passed to ExpansionTileController.of(). ''This usually happens when the context provided is from the same StatefulWidget as that ''whose build function actually creates the ExpansionTile widget being sought.',),ErrorHint('There are several ways to avoid this problem. The simplest is to use a Builder to get a ''context that is "under" the ExpansionTile. For an example of this, please see the ''documentation for ExpansionTileController.of():\n''  https://api.flutter.dev/flutter/material/ExpansionTile/of.html',),ErrorHint('A more efficient solution is to split your build function into several widgets. This ''introduces a new context from which you can obtain the ExpansionTile. In this solution, ''you would have an outer widget that creates the ExpansionTile populated by instances of ''your new inner widgets, and then in these inner widgets you would use ExpansionTileController.of().\n''An other solution is assign a GlobalKey to the ExpansionTile, ''then use the key.currentState property to obtain the ExpansionTile rather than ''using the ExpansionTileController.of() function.',),context.describeElement('The context used was'),]);}/// Finds the [ExpansionTile] from the closest instance of this class that/// encloses the given context and returns its [ExpansionTileController].////// If no [ExpansionTile] encloses the given context then return null./// To throw an exception instead, use [of] instead of this function.////// See also://////  * [of], a similar function to this one that throws if no [ExpansionTile]///    encloses the given context. Also includes some sample code in its///    documentation.static ExpansionTileController? maybeOf(BuildContext context) {return context.findAncestorStateOfType<_BSExpansionTileState>()?._tileController;}
}/// A single-line [ListTile] with an expansion arrow icon that expands or collapses
/// the tile to reveal or hide the [children].
///
/// This widget is typically used with [ListView] to create an
/// "expand / collapse" list entry. When used with scrolling widgets like
/// [ListView], a unique [PageStorageKey] must be specified to enable the
/// [ExpansionTile] to save and restore its expanded state when it is scrolled
/// in and out of view.
///
/// This class overrides the [ListTileThemeData.iconColor] and [ListTileThemeData.textColor]
/// theme properties for its [ListTile]. These colors animate between values when
/// the tile is expanded and collapsed: between [iconColor], [collapsedIconColor] and
/// between [textColor] and [collapsedTextColor].
///
/// The expansion arrow icon is shown on the right by default in left-to-right languages
/// (i.e. the trailing edge). This can be changed using [controlAffinity]. This maps
/// to the [leading] and [trailing] properties of [ExpansionTile].
///
/// {@tool dartpad}
/// This example demonstrates how the [ExpansionTile] icon's location and appearance
/// can be customized.
///
/// ** See code in examples/api/lib/material/expansion_tile/expansion_tile.0.dart **
/// {@end-tool}
///
/// {@tool dartpad}
/// This example demonstrates how an [ExpansionTileController] can be used to
/// programatically expand or collapse an [ExpansionTile].
///
/// ** See code in examples/api/lib/material/expansion_tile/expansion_tile.1.dart **
/// {@end-tool}
///
/// See also:
///
///  * [ListTile], useful for creating expansion tile [children] when the
///    expansion tile represents a sublist.
///  * The "Expand and collapse" section of
///    <https://material.io/components/lists#types>
class BSExpansionTile extends StatefulWidget {/// Creates a single-line [ListTile] with an expansion arrow icon that expands or collapses/// the tile to reveal or hide the [children]. The [initiallyExpanded] property must/// be non-null.const BSExpansionTile({super.key,this.leading,required this.title,this.subtitle,this.onExpansionChanged,this.children = const <Widget>[],this.trailing,this.initiallyExpanded = false,this.maintainState = false,this.tilePadding,this.expandedCrossAxisAlignment,this.expandedAlignment,this.childrenPadding,this.backgroundColor,this.collapsedBackgroundColor,this.textColor,this.collapsedTextColor,this.iconColor,this.collapsedIconColor,this.shape,this.collapsedShape,this.clipBehavior,this.controlAffinity,this.controller,}) : assert(expandedCrossAxisAlignment != CrossAxisAlignment.baseline,'CrossAxisAlignment.baseline is not supported since the expanded children ''are aligned in a column, not a row. Try to use another constant.',);/// A widget to display before the title.////// Typically a [CircleAvatar] widget.////// Depending on the value of [controlAffinity], the [leading] widget/// may replace the rotating expansion arrow icon.final Widget? leading;/// The primary content of the list item.////// Typically a [Text] widget.final Widget title;/// Additional content displayed below the title.////// Typically a [Text] widget.final Widget? subtitle;/// Called when the tile expands or collapses.////// When the tile starts expanding, this function is called with the value/// true. When the tile starts collapsing, this function is called with/// the value false.final ValueChanged<bool>? onExpansionChanged;/// The widgets that are displayed when the tile expands.////// Typically [ListTile] widgets.final List<Widget> children;/// The color to display behind the sublist when expanded.////// If this property is null then [ExpansionTileThemeData.backgroundColor] is used. If that/// is also null then Colors.transparent is used.////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final Color? backgroundColor;/// When not null, defines the background color of tile when the sublist is collapsed.////// If this property is null then [ExpansionTileThemeData.collapsedBackgroundColor] is used./// If that is also null then Colors.transparent is used.////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final Color? collapsedBackgroundColor;/// A widget to display after the title.////// Depending on the value of [controlAffinity], the [trailing] widget/// may replace the rotating expansion arrow icon.final Widget? trailing;/// Specifies if the list tile is initially expanded (true) or collapsed (false, the default).final bool initiallyExpanded;/// Specifies whether the state of the children is maintained when the tile expands and collapses.////// When true, the children are kept in the tree while the tile is collapsed./// When false (default), the children are removed from the tree when the tile is/// collapsed and recreated upon expansion.final bool maintainState;/// Specifies padding for the [ListTile].////// Analogous to [ListTile.contentPadding], this property defines the insets for/// the [leading], [title], [subtitle] and [trailing] widgets. It does not inset/// the expanded [children] widgets.////// If this property is null then [ExpansionTileThemeData.tilePadding] is used. If that/// is also null then the tile's padding is `EdgeInsets.symmetric(horizontal: 16.0)`.////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final EdgeInsetsGeometry? tilePadding;/// Specifies the alignment of [children], which are arranged in a column when/// the tile is expanded.////// The internals of the expanded tile make use of a [Column] widget for/// [children], and [Align] widget to align the column. The [expandedAlignment]/// parameter is passed directly into the [Align].////// Modifying this property controls the alignment of the column within the/// expanded tile, not the alignment of [children] widgets within the column./// To align each child within [children], see [expandedCrossAxisAlignment].////// The width of the column is the width of the widest child widget in [children].////// If this property is null then [ExpansionTileThemeData.expandedAlignment]is used. If that/// is also null then the value of [expandedAlignment] is [Alignment.center].////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final Alignment? expandedAlignment;/// Specifies the alignment of each child within [children] when the tile is expanded.////// The internals of the expanded tile make use of a [Column] widget for/// [children], and the `crossAxisAlignment` parameter is passed directly into/// the [Column].////// Modifying this property controls the cross axis alignment of each child/// within its [Column]. The width of the [Column] that houses [children] will/// be the same as the widest child widget in [children]. The width of the/// [Column] might not be equal to the width of the expanded tile.////// To align the [Column] along the expanded tile, use the [expandedAlignment]/// property instead.////// When the value is null, the value of [expandedCrossAxisAlignment] is/// [CrossAxisAlignment.center].final CrossAxisAlignment? expandedCrossAxisAlignment;/// Specifies padding for [children].////// If this property is null then [ExpansionTileThemeData.childrenPadding] is used. If that/// is also null then the value of [childrenPadding] is [EdgeInsets.zero].////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final EdgeInsetsGeometry? childrenPadding;/// The icon color of tile's expansion arrow icon when the sublist is expanded.////// Used to override to the [ListTileThemeData.iconColor].////// If this property is null then [ExpansionTileThemeData.iconColor] is used. If that/// is also null then the value of [ColorScheme.primary] is used.////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final Color? iconColor;/// The icon color of tile's expansion arrow icon when the sublist is collapsed.////// Used to override to the [ListTileThemeData.iconColor].////// If this property is null then [ExpansionTileThemeData.collapsedIconColor] is used. If that/// is also null and [ThemeData.useMaterial3] is true, [ColorScheme.onSurface] is used. Otherwise,/// defaults to [ThemeData.unselectedWidgetColor] color.////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final Color? collapsedIconColor;/// The color of the tile's titles when the sublist is expanded.////// Used to override to the [ListTileThemeData.textColor].////// If this property is null then [ExpansionTileThemeData.textColor] is used. If that/// is also null then and [ThemeData.useMaterial3] is true, color of the [TextTheme.bodyLarge]/// will be used for the [title] and [subtitle]. Otherwise, defaults to [ColorScheme.primary] color.////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final Color? textColor;/// The color of the tile's titles when the sublist is collapsed.////// Used to override to the [ListTileThemeData.textColor].////// If this property is null then [ExpansionTileThemeData.collapsedTextColor] is used./// If that is also null and [ThemeData.useMaterial3] is true, color of the/// [TextTheme.bodyLarge] will be used for the [title] and [subtitle]. Otherwise,/// defaults to color of the [TextTheme.titleMedium].////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final Color? collapsedTextColor;/// The tile's border shape when the sublist is expanded.////// If this property is null, the [ExpansionTileThemeData.shape] is used. If that/// is also null, a [Border] with vertical sides default to [ThemeData.dividerColor] is used////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final ShapeBorder? shape;/// The tile's border shape when the sublist is collapsed.////// If this property is null, the [ExpansionTileThemeData.collapsedShape] is used. If that/// is also null, a [Border] with vertical sides default to Color [Colors.transparent] is used////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final ShapeBorder? collapsedShape;/// {@macro flutter.material.Material.clipBehavior}////// If this property is null, the [ExpansionTileThemeData.clipBehavior] is used. If that/// is also null, a [Clip.none] is used////// See also:////// * [ExpansionTileTheme.of], which returns the nearest [ExpansionTileTheme]'s///   [ExpansionTileThemeData].final Clip? clipBehavior;/// Typically used to force the expansion arrow icon to the tile's leading or trailing edge.////// By default, the value of [controlAffinity] is [ListTileControlAffinity.platform],/// which means that the expansion arrow icon will appear on the tile's trailing edge.final ListTileControlAffinity? controlAffinity;/// If provided, the controller can be used to expand and collapse tiles.////// In cases were control over the tile's state is needed from a callback triggered/// by a widget within the tile, [ExpansionTileController.of] may be more convenient/// than supplying a controller.final ExpansionTileController? controller;State<BSExpansionTile> createState() => _BSExpansionTileState();
}class _BSExpansionTileState extends State<BSExpansionTile> with SingleTickerProviderStateMixin {static final Animatable<double> _easeOutTween = CurveTween(curve: Curves.easeOut);static final Animatable<double> _easeInTween = CurveTween(curve: Curves.easeIn);static final Animatable<double> _halfTween = Tween<double>(begin: 0.0, end: 0.5);final ShapeBorderTween _borderTween = ShapeBorderTween();final ColorTween _headerColorTween = ColorTween();final ColorTween _iconColorTween = ColorTween();final ColorTween _backgroundColorTween = ColorTween();late AnimationController _animationController;late Animation<double> _iconTurns;late Animation<double> _heightFactor;late Animation<ShapeBorder?> _border;late Animation<Color?> _headerColor;late Animation<Color?> _iconColor;late Animation<Color?> _backgroundColor;bool _isExpanded = false;late ExpansionTileController _tileController;void initState() {super.initState();_animationController = AnimationController(duration: _kExpand, vsync: this);_heightFactor = _animationController.drive(_easeInTween);_iconTurns = _animationController.drive(_halfTween.chain(_easeInTween));_border = _animationController.drive(_borderTween.chain(_easeOutTween));_headerColor = _animationController.drive(_headerColorTween.chain(_easeInTween));_iconColor = _animationController.drive(_iconColorTween.chain(_easeInTween));_backgroundColor = _animationController.drive(_backgroundColorTween.chain(_easeOutTween));_isExpanded = PageStorage.maybeOf(context)?.readState(context) as bool? ?? widget.initiallyExpanded;if (_isExpanded) {_animationController.value = 1.0;}assert(widget.controller?._state == null);_tileController = widget.controller ?? ExpansionTileController();_tileController._state = this;}void dispose() {_tileController._state = null;_animationController.dispose();super.dispose();}void _toggleExpansion() {setState(() {_isExpanded = !_isExpanded;if (_isExpanded) {_animationController.forward();} else {_animationController.reverse().then<void>((void value) {if (!mounted) {return;}setState(() {// Rebuild without widget.children.});});}PageStorage.maybeOf(context)?.writeState(context, _isExpanded);});widget.onExpansionChanged?.call(_isExpanded);}void _handleTap() {_toggleExpansion();}// Platform or null affinity defaults to trailing.ListTileControlAffinity _effectiveAffinity(ListTileControlAffinity? affinity) {switch (affinity ?? ListTileControlAffinity.trailing) {case ListTileControlAffinity.leading:return ListTileControlAffinity.leading;case ListTileControlAffinity.trailing:case ListTileControlAffinity.platform:return ListTileControlAffinity.trailing;}}Widget? _buildIcon(BuildContext context) {return RotationTransition(turns: _iconTurns,child: const Icon(Icons.expand_more),);}Widget? _buildLeadingIcon(BuildContext context) {if (_effectiveAffinity(widget.controlAffinity) != ListTileControlAffinity.leading) {return null;}return _buildIcon(context);}Widget? _buildTrailingIcon(BuildContext context) {if (_effectiveAffinity(widget.controlAffinity) != ListTileControlAffinity.trailing) {return null;}return _buildIcon(context);}Widget _buildChildren(BuildContext context, Widget? child) {final ExpansionTileThemeData expansionTileTheme = ExpansionTileTheme.of(context);final ShapeBorder expansionTileBorder = _border.value ??const Border(top: BorderSide(color: Colors.transparent),bottom: BorderSide(color: Colors.transparent),);final Clip clipBehavior = widget.clipBehavior ?? expansionTileTheme.clipBehavior ?? Clip.none;return Container(clipBehavior: clipBehavior,decoration: ShapeDecoration(color: _backgroundColor.value ?? expansionTileTheme.backgroundColor ?? Colors.transparent,shape: expansionTileBorder,),child: Column(mainAxisSize: MainAxisSize.min,children: <Widget>[ListTileTheme.merge(iconColor: _iconColor.value ?? expansionTileTheme.iconColor,textColor: _headerColor.value,child: ListTile(onTap: _handleTap,contentPadding: widget.tilePadding ?? expansionTileTheme.tilePadding,leading: widget.leading ?? _buildLeadingIcon(context),title: widget.title,subtitle: widget.subtitle,trailing: widget.trailing,),),ClipRect(child: Align(alignment: widget.expandedAlignment ?? expansionTileTheme.expandedAlignment ?? Alignment.center,heightFactor: _heightFactor.value,child: child,),),],),);}void didChangeDependencies() {final ThemeData theme = Theme.of(context);final ExpansionTileThemeData expansionTileTheme = ExpansionTileTheme.of(context);final ExpansionTileThemeData defaults =theme.useMaterial3 ? _ExpansionTileDefaultsM3(context) : _ExpansionTileDefaultsM2(context);_borderTween..begin = widget.collapsedShape ??expansionTileTheme.collapsedShape ??const Border(top: BorderSide(color: Colors.transparent),bottom: BorderSide(color: Colors.transparent),)..end = widget.shape ??expansionTileTheme.collapsedShape ??Border(top: BorderSide(color: theme.dividerColor),bottom: BorderSide(color: theme.dividerColor),);_headerColorTween..begin = widget.collapsedTextColor ?? expansionTileTheme.collapsedTextColor ?? defaults.collapsedTextColor..end = widget.textColor ?? expansionTileTheme.textColor ?? defaults.textColor;_iconColorTween..begin = widget.collapsedIconColor ?? expansionTileTheme.collapsedIconColor ?? defaults.collapsedIconColor..end = widget.iconColor ?? expansionTileTheme.iconColor ?? defaults.iconColor;_backgroundColorTween..begin = widget.collapsedBackgroundColor ?? expansionTileTheme.collapsedBackgroundColor..end = widget.backgroundColor ?? expansionTileTheme.backgroundColor;super.didChangeDependencies();}Widget build(BuildContext context) {final ExpansionTileThemeData expansionTileTheme = ExpansionTileTheme.of(context);final bool closed = !_isExpanded && _animationController.isDismissed;final bool shouldRemoveChildren = closed && !widget.maintainState;final Widget result = Offstage(offstage: closed,child: TickerMode(enabled: !closed,child: Padding(padding: widget.childrenPadding ?? expansionTileTheme.childrenPadding ?? EdgeInsets.zero,child: Column(crossAxisAlignment: widget.expandedCrossAxisAlignment ?? CrossAxisAlignment.center,children: widget.children,),),),);return AnimatedBuilder(animation: _animationController.view,builder: _buildChildren,child: shouldRemoveChildren ? null : result,);}
}class _ExpansionTileDefaultsM2 extends ExpansionTileThemeData {_ExpansionTileDefaultsM2(this.context);final BuildContext context;late final ThemeData _theme = Theme.of(context);late final ColorScheme _colorScheme = _theme.colorScheme;Color? get textColor => _colorScheme.primary;Color? get iconColor => _colorScheme.primary;Color? get collapsedTextColor => _theme.textTheme.titleMedium!.color;Color? get collapsedIconColor => _theme.unselectedWidgetColor;
}// BEGIN GENERATED TOKEN PROPERTIES - ExpansionTile// Do not edit by hand. The code between the "BEGIN GENERATED" and
// "END GENERATED" comments are generated from data in the Material
// Design token database by the script:
//   dev/tools/gen_defaults/bin/gen_defaults.dart.// Token database version: v0_162class _ExpansionTileDefaultsM3 extends ExpansionTileThemeData {_ExpansionTileDefaultsM3(this.context);final BuildContext context;late final ThemeData _theme = Theme.of(context);late final ColorScheme _colors = _theme.colorScheme;Color? get textColor => _colors.onSurface;Color? get iconColor => _colors.primary;Color? get collapsedTextColor => _colors.onSurface;Color? get collapsedIconColor => _colors.onSurfaceVariant;
}// END GENERATED TOKEN PROPERTIES - ExpansionTile

总结

这就是解决ExpansionTile上下分割线问题,以及title撑满问题,希望能够帮到你,谢谢。

相关文章:

Flutter 解决ExpansionTile上下分割线问题,以及title撑满问题

文章目录 前言一、解决上下分割线问题二、使ExpansionTile的title撑满总结 前言 最近在做flutter项目&#xff0c;其中的一个功能用到了ExpansionTile的效果&#xff0c;奈何我们的设计师要求很高&#xff0c;展开的时候不能有上下一根线&#xff0c;而且我们是不需要展开的按…...

数据可视化 pycharts实现时间数据可视化

自用版 数据格式为&#xff1a; 运行效果为&#xff1a; from pyecharts import options as opts from pyecharts.charts import Polar, Page import csv filename "./hot-dog-places.csv" data_x [] data_y [] with open(filename) as f:reader csv.reade…...

深度强化学习(王树森)笔记11

深度强化学习&#xff08;DRL&#xff09; 本文是学习笔记&#xff0c;如有侵权&#xff0c;请联系删除。本文在ChatGPT辅助下完成。 参考链接 Deep Reinforcement Learning官方链接&#xff1a;https://github.com/wangshusen/DRL 源代码链接&#xff1a;https://github.c…...

python 实现 macOS状态栏 网速实时显示

安装依赖包&#xff1a; pip install pillow psutil rumpsnetSpeedApp.py from PIL import Image, ImageDraw, ImageFont import psutil import rumpsclass NetSpeedApp(rumps.App):def __init__(self):super(NetSpeedApp, self).__init__("NetSpeed")self.titlese…...

【C++】开源:Windows图形库EasyX配置与使用

&#x1f60f;★,:.☆(&#xffe3;▽&#xffe3;)/$:.★ &#x1f60f; 这篇文章主要介绍Windows图形库EasyX配置与使用。 无专精则不能成&#xff0c;无涉猎则不能通。——梁启超 欢迎来到我的博客&#xff0c;一起学习&#xff0c;共同进步。 喜欢的朋友可以关注一下&#…...

微信小程序 全局变量键值对map对象

在微信小程序中&#xff0c;键值对的map对象通常用于存储和操作键值对的集合。以下是一些常见的操作&#xff1a; 创建map对象 在JavaScript中&#xff0c;可以通过对象字面量语法或者使用new Map()来创建map对象 // 使用对象字面量 var map {key1: value1,key2: value2 };…...

20240131在WIN10下配置whisper

20240131在WIN10下配置whisper 2024/1/31 18:25 首先你要有一张NVIDIA的显卡&#xff0c;比如我用的PDD拼多多的二手GTX1080显卡。【并且极其可能是矿卡&#xff01;】800&#xffe5; 2、请正确安装好NVIDIA最新的545版本的驱动程序和CUDA。 2、安装Torch 3、配置whisper http…...

3338 蓝桥杯 wyz的数组IV 简单

3338 蓝桥杯 wyz的数组IV 简单 //C风格解法1&#xff0c;通过率50% #include<bits/stdc.h>int main(){std::ios::sync_with_stdio(false);std::cin.tie(nullptr);std::cout.tie(nullptr);int n; std::cin >> n;int ans 0;std::vector<int>a(n);for(auto &am…...

git Filename too long

git Filename too long 原因&#xff1a; 文件名限制260长度 解决&#xff1a;全局配置git git config --system core.longpaths true查看&#xff1a; git config --get core.longpaths...

MySQL数据库-理论基础

1.1 什么是数据库 数据&#xff1a; 描述事物的符号记录&#xff0c; 可以是数字、 文字、图形、图像、声音、语言等&#xff0c;数据有多种形式&#xff0c;它们都可以经过数字化后存入计算机。 数据库&#xff1a; 存储数据的仓库&#xff0c;是长期存放在计算机内、有组织…...

立体边界,让arcgis出图更酷炫一些

就是这样子的那个图—— 本期我们还是用长沙市为例&#xff0c; 来手把手的演示制作立体边界&#xff0c; 就是这个样子的边界—— 第一步—准备底图 其实你准备什么底图都可以哈&#xff0c;例如调用天地图、下载个影像图&#xff0c;或者用其他什么的底图&#xff0c;都是…...

【C++】 C++入门—内联函数

C入门 1 内联函数1.1 定义1.2 查看方式1.3 注意 Thanks♪(&#xff65;ω&#xff65;)&#xff89;谢谢阅读下一篇文章见&#xff01;&#xff01;&#xff01; 1 内联函数 1.1 定义 程序在执行一个函数前需要做准备工作&#xff1a;要将实参、局部变量、返回地址以及若干寄存…...

软件工程知识梳理2-需求分析

需求分析时软件定义的最后一个阶段&#xff0c;它的基本任务时准确回答系统必须做什么的问题。 输出&#xff1a;本阶段必须的输出时软件需求规格说明书。 角色&#xff1a;需求分析员 参与者&#xff1a;用户、需求分析员 需求分析遵循的准则&#xff1a; 必须理解并描述问…...

mac裁剪图片

今天第一次用mac裁剪图片&#xff0c;记录一下过程&#xff0c;差点我还以为我要下载photoshop了&#xff0c; 首先准备好图片 裁剪的目的是把图片的标题给去掉&#xff0c;但是不能降低分辨率&#xff0c;否则直接截图就可以了 解决办法 打开原始图片(不要使用预览&#xf…...

Compose | UI组件(十) | Box,Surface - 帧布局

文章目录 前言Box 组件的参数说明Box 组件的使用Surface 的参数说明Surface 的使用 总结 前言 Box组件是 按子组件依次叠加 的布局组件&#xff0c;相当传统View中的 FrameLayout Box 组件的参数说明 Composable inline fun Box(modifier: Modifier Modifier, …...

种草日记|林曦老师的冬日好物分享

冬天将尽春天就要来了&#xff0c;换季的时候最容易引起皮肤干燥、头发毛躁不舒服的问题&#xff0c;今天就来说说林曦老师推荐的冬日护理爱用好物。大家都要“如婴儿乎”&#xff0c;照顾好自己哦&#xff5e;      1、Aco甘油保湿霜    Aco甘油保湿霜好大一罐&#x…...

【算法与数据结构】139、LeetCode单词拆分

文章目录 一、题目二、解法三、完整代码 所有的LeetCode题解索引&#xff0c;可以看这篇文章——【算法和数据结构】LeetCode题解。 一、题目 二、解法 思路分析&#xff1a;本题可以看做一个动态规划问题。其中&#xff0c;字符串s是背包&#xff0c;而字典中的单词就是物品。…...

NLP任务之Named Entity Recognition

深度学习的实现方法&#xff1a; 双向长短期记忆网络&#xff08;BiLSTM&#xff09;: BiLSTM是一种循环神经网络&#xff08;RNN&#xff09;的变体&#xff0c;能够捕捉序列数据中的长期依赖关系。在NER任务中&#xff0c;BiLSTM能有效地处理文本序列&#xff0c;捕捉前后文本…...

NUXT3项目实践总结

目录 一、NUXT3实现黑夜白天模式切换 需求 实现 效果 二、scrollreveal插件实现动画效果 需求 实现 封装 使用 文档 效果 三、useSeoMeta的使用 作用 使用 效果 四、NUXT3开启代理 使用 注意 五、$fetch、useFetch 、useAsyncData的区别 六、错误页面处理 …...

中科星图——2020年全球30米地表覆盖精细分类产品V1.0(29个地表覆盖类型)

数据名称&#xff1a; 2020年全球30米地表覆盖精细分类产品V1.0 GLC_FCS30 长时序 地表覆盖 动态监测 全球 数据来源&#xff1a; 中国科学院空天信息创新研究院 时空范围&#xff1a; 2015-2020年 空间范围&#xff1a; 全球 数据简介&#xff1a; 地表覆盖分布…...

Tomcat 部署项目时 war 和 war exploded区别

在 Tomcat 调试部署的时候&#xff0c;我们通常会看到有下面 2 个选项。 是选择war还是war exploded 这里首先看一下他们两个的区别&#xff1a; war 模式&#xff1a;将WEB工程以包的形式上传到服务器 &#xff1b;war exploded 模式&#xff1a;将WEB工程以当前文件夹的位置…...

【开源】SpringBoot框架开发天然气工程运维系统

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 系统角色分类2.2 核心功能2.2.1 流程 12.2.2 流程 22.3 各角色功能2.3.1 系统管理员功能2.3.2 用户服务部功能2.3.3 分公司&#xff08;施工单位&#xff09;功能2.3.3.1 技术员角色功能2.3.3.2 材料员角色功能 2.3.4 安…...

go数据操作-MySQL

1.快速入门 下载依赖 go get -u github.com/go-sql-driver/mysql使用MySQL驱动 func Open(driverName, dataSourceName string) (*DB, error)Open打开一个dirverName指定的数据库&#xff0c;dataSourceName指定数据源&#xff0c;一般至少包括数据库文件名和其它连接必要的…...

基于node.js和Vue3的医院挂号就诊住院信息管理系统

摘要&#xff1a; 随着信息技术的快速发展&#xff0c;医院挂号就诊住院信息管理系统的构建变得尤为重要。该系统旨在提供一个高效、便捷的医疗服务平台&#xff0c;以改善患者就医体验和提高医院工作效率。本系统基于Node.js后端技术和Vue3前端框架进行开发&#xff0c;利用其…...

Django如何调用机器学习模型进行预测

Django是一个流行的Python Web框架,它可以很方便地集成机器学习模型,进行预测和推理。我将介绍如何在Django项目中调用训练好的机器学习模型,并实现一个预测接口。 准备工作 首先我们需要一个训练好的机器学习模型。这里我们使用Scikit-Learn训练一个简单的线性回归模型作为示…...

Web3.0初探

Web3.0初探 一、互联网发展史二、什么是Web3.0&#xff1f;三、现在的发展方向&#xff08;衍生出来的产品&#xff09;&#xff1a;四、目前问题五、Web3.0与元宇宙 一、互联网发展史 Web3.0也就是第三代互联网。最新版本的Web3.0是以太坊的创始合伙人Gavin Wood在2014年提出…...

在windows和Linux中的安装 boost 以及 安装 muduo 和 mysql

一、CMake安装 Ubuntu Linux 下安装和卸载cmake 3.28.2版本-CSDN博客https://blog.csdn.net/weixin_41987016/article/details/135960115?spm1001.2014.3001.5501二、安装boost boost官网&#xff1a;boost官网 我下载的boost版本&#xff1a; windows:boost_1_84_0.zipli…...

WPOpenSocial实现WordPress的QQ登录

个人建站不可避免的需要自己搭建用户数据库的问题&#xff0c;可用户却往往因为注册繁琐而放弃浏览您的网站&#xff0c;由此可见&#xff0c;一个社交账号一键登录方式尤为重要。选择适合您网站需求的社交插件&#xff0c;可以提升用户互动&#xff0c;增加社交分享&#xff0…...

关于我用AI编写了一个聊天机器人……(7)

此次更新为v1.3.4版本&#xff0c;更新内容&#xff1a;增加显示时间功能 代码如下&#xff1a; #include <bits/stdc.h> #include <ctime> using namespace std; string userInput; class VirtualRobot { public:void chat() {cout << "你好&#x…...

WebService的services.xml问题

WebService有多种实现方式&#xff0c;这里使用的是axis2 问题&#xff1a; 在本地开发&#xff0c;访问本地的http://localhost:8080/services/ims?wsdl&#xff0c;正常访问 但是打成jar包&#xff0c;不管是linux还是window启动&#xff0c;都访问不到&#xff0c;报错…...