osam_flutter 2.0.7 osam_flutter: ^2.0.7 copied to clipboard
Navigation and UI elements which fits with Osam library
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() async {
runApp(MaterialApp(
home: const App(),
));
}
class App extends StatefulWidget {
const App();
@override
_AppState createState() => _AppState();
}
class _AppState extends State<App> {
var isOpposite = false;
@override
Widget build(BuildContext context) {
final el1 = Element(color: Colors.blue);
final el2 = Element(color: Colors.red);
return Center(
child: Column(
children: <Widget>[
Row(
children: isOpposite ? [el1, el2] : [el2, el1],
),
RaisedButton(
onPressed: () {
setState(() {
isOpposite = !isOpposite;
});
},
)
],
),
);
}
}
class Element extends StatefulWidget {
final Color color;
const Element({Key key, this.color}) : super(key: key);
@override
_ElementState createState() => _ElementState();
}
class _ElementState extends State<Element> {
@override
Widget build(BuildContext context) {
return Container(color: widget.color, width: 50, height: 50);
}
}