bluff 0.1.11

  • Readme
  • Changelog
  • Example
  • Installing
  • 48

Bluff #

Diclaimer : I built this for my own needs, so don't expect it to be complete. It is a weekend hack, use at your own risk! #

Bluff is a static website generator written in dart that is inspired by Flutter widgets.

Why ?

I started this project because I was tired of switching to a js environment everytime I need to write a small static website. I wanted the concept to be nearest of Flutter as possible, again, to keep the same way of developing user interfaces and not loosing time relearning paradigms again and again.

Why not using Flutter for web ?

Just because I wanted a really lightweight website with good SEOs. The migration to Flutter for web should be pretty simple though.

Usage #

A simple usage example:

import 'package:bluff/bluff.dart';

Future main() async {
  final app = Application(
    availableSizes: [
      MediaSize.small,
      MediaSize.medium,
    ],
    supportedLocales: [
      Locale('fr', 'FR'),
      Locale('en', 'US'),
    ],
    routes: [
      homeRoute,
    ],
  );
  ;

  await publish(app);
}

final homeRoute = Route(
  title: (context) {
    final locale = Localizations.localeOf(context);
    if (locale.languageCode == 'fr') return 'Accueil';
    return 'Home';
  },
  relativeUrl: 'index',
  builder: (context) => Home(),
);

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final mediaQuery = MediaQuery.of(context);
    final theme = Theme.of(context);
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: <Widget>[
        Flex(
          direction: mediaQuery.size == MediaSize.small
              ? Axis.vertical
              : Axis.horizontal,
          children: <Widget>[
            Expanded(
              child: Container(
                height: 300,
                decoration: BoxDecoration(
                  image: DecorationImage(
                    image: ImageProvider.asset('images/logo_dart_192px.svg'),
                  ),
                ),
              ),
            ),
            Padding(
              padding: EdgeInsets.all(20),
              child: Text('Hello world!'),
            ),
            Container(
              width: 200,
              height: 200,
              decoration: BoxDecoration(
                color: const Color(0xFF0000FF),
                borderRadius: BorderRadius.circular(5),
                boxShadow: [
                  BoxShadow(
                    color: const Color(0xAA0000FF),
                    blurRadius: 10,
                    offset: Offset(10, 10),
                  ),
                ],
              ),
            ),
            Image.asset(
              'images/logo_dart_192px.svg',
              fit: BoxFit.cover,
            ),
            Click(
              newTab: true,
              url: 'https://www.google.com',
              builder: (context, state) {
                return Container(
                  child: Text(
                    'Button',
                    style: theme.text.paragraph.merge(
                      TextStyle(
                        color: state == ClickState.hover
                            ? const Color(0xFFFFFFFF)
                            : const Color(0xFF0000FF),
                      ),
                    ),
                  ),
                  padding: EdgeInsets.all(20),
                  decoration: BoxDecoration(
                    color: state == ClickState.hover
                        ? const Color(0xFF0000FF)
                        : const Color(0x440000FF),
                    borderRadius: BorderRadius.circular(5),
                  ),
                );
              },
            )
          ],
        )
      ],
    );
  }
}

0.1.11 #

  • Added line height.

0.1.10 #

  • Fixed line breaks.

0.1.9 #

  • Fixed line breaks.

0.1.8 #

  • Fixed line breaks.

0.1.7 #

  • Fixed missing properties when copying app.

0.1.6 #

  • Added build context to post render action.

0.1.5 #

  • Added meta and post render action to app.

0.1.4 #

  • Default main axis size to min.

0.1.3 #

  • Fixing main axis size min.

0.1.2 #

  • Fixed anchor navigation

0.1.1 #

  • Updated example

0.1.0 #

  • Initial version

example/bluff_example.dart

import 'package:bluff/bluff.dart';

import 'routes/home.dart';

Future main() async {
  final app = Application(
    availableSizes: [
      MediaSize.small,
      MediaSize.medium,
    ],
    supportedLocales: [
      Locale('fr', 'FR'),
      Locale('en', 'US'),
    ],
    routes: [
      homeRoute,
    ],
  );
  ;

  await publish(app);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  bluff: ^0.1.11

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:bluff/bluff.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
6
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
92
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

We analyzed this package on Mar 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/src/base/text.dart. (-2.96 points)

Analysis of lib/src/base/text.dart reported 6 hints, including:

line 321 col 20: The value of the field '_kEncodedSize' isn't used.

line 323 col 8: The declaration '_encode' isn't referenced.

line 395 col 52: DO use curly braces for all flow control structures.

line 497 col 11: The declaration '_encodeTextStyle' isn't referenced.

line 693 col 7: DO use curly braces for all flow control structures.

Fix lib/src/base/geometry.dart. (-2.48 points)

Analysis of lib/src/base/geometry.dart reported 5 hints:

line 444 col 7: DO use curly braces for all flow control structures.

line 675 col 19: The declaration '_value32' isn't referenced.

line 873 col 7: DO use curly braces for all flow control structures.

line 1185 col 19: The declaration '_value32' isn't referenced.

line 1629 col 9: DO use curly braces for all flow control structures.

Fix lib/src/base/edge_insets.dart. (-1.49 points)

Analysis of lib/src/base/edge_insets.dart reported 3 hints:

line 205 col 7: DO use curly braces for all flow control structures.

line 231 col 9: DO use curly braces for all flow control structures.

line 233 col 9: DO use curly braces for all flow control structures.

Fix additional 6 files with analysis or formatting issues. (-4 points)

Additional issues in the following files:

  • lib/src/base/box_border.dart (2 hints)
  • lib/src/widgets/text.dart (2 hints)
  • lib/src/base/border_radius.dart (1 hint)
  • lib/src/base/borders.dart (1 hint)
  • lib/src/base/decoration.dart (1 hint)
  • lib/src/base/hash_values.dart (1 hint)

Maintenance suggestions

The package description is too short. (-8 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
meta ^1.1.8 1.1.8
path ^1.6.4 1.6.4
universal_html ^1.1.12 1.1.20
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.12
convert 2.1.1
csslib 0.16.1
html 0.14.0+3
petitparser 3.0.2
source_span 1.7.0
term_glyph 1.1.0
typed_data 1.1.6
universal_io 1.0.1
xml 3.7.0 4.1.0
zone_local 0.1.2
Dev dependencies
pedantic ^1.8.0
test ^1.6.0