ToggleElement class
Direct child of NeumorphismToggle Contains two widgets : background & foreground
The thumb is displayed between background & foreground
Expanded( child: NeumorphismToggle( height: 50, selectedIndex: _selectedIndex, displayForegroundOnlyIfSelected: true, children: ToggleElement( background: Center(child: Text("This week", style: TextStyle(fontWeight: FontWeight.w500),)), foreground: Center(child: Text("This week", style: TextStyle(fontWeight: FontWeight.w700),)), ), ToggleElement( background: Center(child: Text("This month", style: TextStyle(fontWeight: FontWeight.w500),)), foreground: Center(child: Text("This month", style: TextStyle(fontWeight: FontWeight.w700),)), ), ToggleElement( background: Center(child: Text("This year", style: TextStyle(fontWeight: FontWeight.w500),)), foreground: Center(child: Text("This year", style: TextStyle(fontWeight: FontWeight.w700),)), ) , thumb: Neumorphic( boxShape: NeumorphismBoxShape.roundRect(borderRadius: BorderRadius.all(Radius.circular(12))), ), onChanged: (value) { setState(() { _selectedIndex = value; print("_firstSelected: $_selectedIndex"); }); }, ), ),
Constructors
- ToggleElement({Widget? background, Widget? foreground})
Properties
- background → Widget?
-
final
- foreground → Widget?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited