fss 1.0.0 fss: ^1.0.0 copied to clipboard
Flutter Style Sheets allows you to style your widgets with a "CSS like" theme file.
Flutter Style Sheets examples #
A simple test app that shows how to create a box and some text and how to style them with a FSS style-sheet.
The result will then look like this:
Here the corresponding stylesheet and code.
import 'dart:core';
import 'package:flutter/material.dart';
import 'package:fss/fss.dart';
/// The stylesheet should normally be an own assets file
/// It is defined here inline for the example
const styleSheet = '''
.box {
width: 200px;
height: 50px;
text-align: center;
margin: 5px;
background-image: linear-gradient(180deg, #111174, #3d72b4);
border-radius: 10px;
box-shadow: 3 3 1.5 0.5 gray;
}
#myText {
color: white;
font-size: 32px;
}
''';
/// Entry point
void main() {
runApp(const TestApp());
}
/// Creates a simple app
class TestApp extends StatelessWidget {
const TestApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'FSS Simple Demo',
// Install the theme with the given stylesheet
builder: (c, _) => FssTheme.withAppDefaults(
context: c,
stylesheet: styleSheet,
// Add a div with a given "class" and a text with a given "id"
child: Center(
child: Fss.div(
fssClass: 'box',
child: Fss.text('Hello World', fssID: 'myText'),
),
),
),
);
}
}
Look into the other examples to see how this all works with more complex widgets.