Comments (2)
Wrapping ToggleSwitch
inside Center
somehow fixed it.
I don't know if the above solution is an intended behavior or just a workaround so I will keep this issue open.
from toggle_switch.
@khoadng It seems like this is a sliver widget behavior that causes child widgets to stretch to device width. You can also re-create this with a simple container (code below),
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: CustomScrollView(
slivers: [
SliverPadding(
padding: const EdgeInsets.only(top: 100),
sliver: SliverToBoxAdapter(
child: Container(
width: 80.0,
color: Colors.blue,
child: Text('Test'),
),
),
)
],
),
),
);
}
}
Closing this.
Anyone experiencing this behavior, please wrap toggle_switch
with Center
from toggle_switch.
Related Issues (20)
- Safari (I can't toggle on Safari) HOT 3
- Allow RichTitle or Widget for labels HOT 3
- How to add TextField between two switches? HOT 2
- Allow disable tab HOT 2
- Allow Custom Font Style but still respect activeFgColor and inactiveFgColor HOT 3
- How to deselect the selected option (switch) programmatically? HOT 1
- expanding the view HOT 2
- Allow intialValueIndex to be null HOT 2
- Swipe Feature
- Add a field "selectedIndex" to change selected tab programmatically HOT 2
- Widget refuse to update/switch to next index when used with provider management. HOT 8
- Using minWidth: double.maxFinite to expand does not work properly if the ToggleSwitch is inside Padding or other widget HOT 13
- Allow to automatically set width based on text length HOT 1
- foreground color HOT 1
- Is there a way to change icon's color on toggle? HOT 2
- how to change textstyle of active toggle ? HOT 1
- Add label to the switch HOT 1
- increase labels length after setState but no change in length HOT 4
- customWidths is not working. 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 toggle_switch.